When printing a pandas dataframe in jupyter, no horizontal scroll is created, instead columns that don't fit are printed after the columns that fit.
Toy example:
d = {'long_column_name1': [1, 2,3,4,5,6,7,8,9],
'long_column_name2': [1, 2,3,4,5,6,7,8,9],
'long_column_name3': [1, 2,3,4,5,6,7,8,9],
'long_column_name4': [1, 2,3,4,5,6,7,8,9],
'long_column_name5': [1, 2,3,4,5,6,7,8,9],
'long_column_name6': [1, 2,3,4,5,6,7,8,9],
'long_column_name7': [1, 2,3,4,5,6,7,8,9],
'long_column_name8': [1, 2,3,4,5,6,7,8,9]}
df = pd.DataFrame(data=d)
print(df)
In this case there are only 9 rows, and 8 columns, which is still readable, but having more rows and columns will make it really hard to read.
Is there a way that all columns are printed horizontally, adding an horizontal scrollbar if needed?
You can try df
instead of print(df)
. Which makes it scrollable.
And if you want the columns to be printed horizontal you could use df.transpose()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With