我当前在我的数据框架中有120列。当我执行
时df.columns
我得到了一个截断的列表,其中我只看到20列而不是120列:
Index(['Reporting_FI', 'Reporting_FI_identification',
'Reporting_FI_identification_type', 'Reporting_FI_street_address_1',
'Reporting_FI_street_address_2', 'Reporting_FI_city',
'Reporting_FI_state', 'Reporting_FI_postal_code',
'Reporting_FI_country_code', 'Transaction_date',
...
'FI_country_code_3', 'FI_name_4', 'FI_branch_4', 'FI_identification_4',
'FI_identification_type_4', 'FI_account_number_4', 'FI_city_4',
'FI_state_4', 'FI_country_code_4', 'Additional_infomation_2'],
dtype='object', length=120)
如何调整它以显示全部120?
我不是在寻找:
pd.set_option('display.max_columns', 120)
谢谢
一种简单的方法是在打印之前转换为list
:
res = df.columns.tolist()
print(res)