我运行了一个python代码并得到了数据帧输出,如:
1 Department of Susta... (2) Community Services (2)
2 Department of Commu... (2) Community Services (2)
3 Sustainability Vict... (1) Community Services (1)
4 Southern Grampians ... (1) Community Services (1)
5 Productivity Commis... (1) Community Services (1)
6 Parliament of NSW (1) Community Services (1)
.. ... ...
30 Noosa Shire Council (2) Sport and Recreation (2)
31 State Library of Qu... (1) Sport and Recreation (1)
32 Emergency Services ... (1) Sport and Recreation (1)
33 Department of Susta... (1) Sport and Recreation (1)
现在我没有b / w 7到29行。如何获取所有行?
答案 0 :(得分:3)
这只是显示问题,我更喜欢:
#temporaly display 999 rows
with pd.option_context('display.max_rows', 999):
print (df)
退出with
块时会自动恢复选项值。
答案 1 :(得分:1)
从0.20.2开始,默认情况下,pandas仅显示数据中的60行。您可以使用
更改此设置pd.set_option('display.max_rows',n)
其中n
是您希望它显示的行数。
答案 2 :(得分:1)
你可以创建一个像这样的函数
def print_full(x):
pd.set_option('display.max_rows', len(x))
print(x)
pd.reset_option('display.max_rows')