Python 无法查看 Pandas 数据框中的所有列
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28775813/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Not able to view all columns in Pandas Data frame
提问by sushmit
I am trying to output all columns of a data frame .
我正在尝试输出数据框的所有列。
Here is the code below:
这是下面的代码:
df_advertiser_activity_part_qa = df_advertiser_activity_part.loc[(df_advertiser_activity_part['advertiser_id']==209988 )]
df_advertiser_activity_part_qa.sort(columns ='date_each_day_et')
df_advertiser_activity_part_qa
when I output the data frame not all columns gets displayed . This has 21 columns and between some columns there is just there dots "..." I am using ipython notebook . Is there a way by which this can be ignored.![enter image description here][1]
当我输出数据框时,并非所有列都显示出来。这有 21 列,在某些列之间只有点“...”我正在使用 ipython notebook 。有没有办法可以忽略它。![在此处输入图像描述][1]
采纳答案by JAB
try:
尝试:
pandas.set_option('display.max_columns', None)
but depending how many columns you have this is not a good idea. The data is being abbreviated because you have too many columns to fit practically on the screen.
但取决于你有多少列,这不是一个好主意。数据被缩写是因为您有太多的列无法在屏幕上实际显示。
You might be better off saving to a .csv
to inspect the data.
您最好保存到 a.csv
以检查数据。
df.to_csv('myfile.csv')
or if you have lots of rows:
或者如果你有很多行:
df.head(1000).to_csv('myfile.csv')