Katty_one
Katty_one

Reputation: 351

How to show all dataframe in a list, one per line in jupyter notebook

I have a list of dataframes:

type(l)
output: list

type(l[0])
output: pandas.core.DatFrame

I want to dataframe.head(5) but getting one dataframe per line in a jupyter-notebook

I can do:

for dataframe in l:
    print(daframe.head(3))

But I get all dataframes in the same line and it's pretty to read it. Is there a better way to show all dataframes, one per line in jupyter?

dummy df:

df=pd.DataFrame({'area':['lab','class_room','pool','gardem'],'%_chance':[0.33,0.27,.30,.10]})
da=pd.DataFrame({'city':['jess','nobytown','paris','miami'],'%_chance':[0.5,0.30,.15,.05]})
db=pd.DataFrame({'country':['china','japan','france','eua'],'%_chance':[0.43,0.27,.20,.10]})

Dataframe's name list

list_df=[df,da,db]

This what I mean by one dataframe per line in jupyter: enter image description here

Upvotes: 0

Views: 699

Answers (1)

Katty_one
Katty_one

Reputation: 351

You can do this using:

from IPython.display import display
for l in dataframes:
    display(l)

Upvotes: 3

Related Questions