1

I have a dataframe with more than 1000 columns. I would like to get a list of all column headers, but everything i tried so far works up to 1000 column names.

list(df.columns.values) list(df) 

This is the output what i got:

enter image description here

Is there any possibility to get a list of ALL column headers?

1 Answer 1

1

All of the columns are there, they are just not being printed.

Try this!

for col in df.columns: print(col) 

Or, to make it a list...

mylist = [] for col in df.columns: mylist.append(col) 
Sign up to request clarification or add additional context in comments.

2 Comments

the first solution works - the print cols. But the second shows the only 1000 column headers. I suppose that the LIST in python is so limited.
I think the interpreter you're using only prints 1000, but they are there (in the ...), if the answer worked plz accept it!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.