Fetching all rows of dataframe using Python pandas
本问题已经有最佳答案,请猛点这里访问。
我运行了一个python代码并得到了数据帧输出,比如:
1 2 3 4 5 6 7 8 9 10 11 | 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行。如何获取所有行?
这只是显示问题,我更喜欢:
1 2 3 | #temporaly display 999 rows with pd.option_context('display.max_rows', 999): print (df) |
退出
你可以创建这样的函数
1 2 3 4 | def print_full(x): pd.set_option('display.max_rows', len(x)) print(x) pd.reset_option('display.max_rows') |
从0.20.2开始,默认情况下,熊猫只显示数据的60行。你可以把这个换成
1 | pd.set_option('display.max_rows',n) |
号
其中,