Home > front end >  How to show row dataframe?
How to show row dataframe?

Time:05-25

I have a dict of datarames dict_of_dfs.

I try two show first row from each dataset:

for colsKey, colsValue in dict_of_cols.items():
    dict_of_dfs['dt_' str(colsKey)] = pd.DataFrame(colsValue)

for dfName, val in dict_of_dfs.items():
    row = dict_of_dfs[dfName].head(1)
    row

But it does not work for me.

This also does not return me output pandas frame:

for dfName in dict_of_dfs.keys():
    dict_of_dfs['dt_12'].head(1).to_string()

CodePudding user response:

I assume you are working in Jupyter Notebook. You can use the display function from IPython.display.

from IPython.display import display
for dfName, val in dict_of_dfs.items():
    display(val.head(1))
  • Related