2

I currently have 120 columns in my DataFrame. When I execute

df.columns 

I get a truncated list, where I only see 20 instead of 120 columns:

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)

How do I adjust this to display all 120?

I am not looking for:

pd.set_option('display.max_columns', 120)

Thanks

1 Answer 1

1

One easy way is to convert to list before printing:

res = df.columns.tolist()

print(res)
Sign up to request clarification or add additional context in comments.

1 Comment

Dang, why didn't I think of that! Very clever. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.