无法查看Pandas数据框中的所有列 [英] Not able to view all columns in Pandas Data frame
问题描述
我正在尝试输出数据框的所有列.
I am trying to output all columns of a data frame .
这是下面的代码:
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
当我输出数据框时,并不是所有的列都显示出来.它有21列,而在某些列之间,只有点"...".我正在使用ipython notebook.有没有一种可以忽略不计的方法.![在此处输入图片描述] [1]
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]
推荐答案
尝试:
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.
最好保存到.csv
来检查数据.
You might be better off saving to a .csv
to inspect the data.
df.to_csv('myfile.csv')
或者如果您有很多行:
df.head(1000).to_csv('myfile.csv')
这篇关于无法查看Pandas数据框中的所有列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!