Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Showing all rows and columns of Pandas dataframe [duplicate]

I am working with python 3 and the pandas package in visual studio code and I the print() function is not displaying correctly.

For example when I am using df.head() it looks good.

df.head() example

But If I use the print() statement I no longer see all of the columns next to each other, some of them get dragged down for some reason. And I can't see the entire data

print(df) example

Anyone knows what I can do to see the entire data, and all of the columns next to each other?

like image 926
Mihai Stoica Avatar asked Dec 29 '25 14:12

Mihai Stoica


1 Answers

The problem comes from library pandas that cuts part of your DataFrame when it's too long.

To show all rows and columns, use:

pandas.set_option('display.max_rows', None)
pandas.set_option('display.max_columns', None)

If you use an "old" pandas version use instead:

pandas.set_option('max_row', None)
like image 195
dallonsi Avatar answered Jan 01 '26 06:01

dallonsi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!