如何显示行数据框?
How to show row dataframe?
我有一个数据帧字典 dict_of_dfs
。
我尝试两个显示每个数据集的第一行:
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
但这对我不起作用。
这也不return我输出pandas帧:
for dfName in dict_of_dfs.keys():
dict_of_dfs['dt_12'].head(1).to_string()
我假设您正在使用 Jupyter Notebook。您可以使用 IPython.display
.
中的 display
函数
from IPython.display import display
for dfName, val in dict_of_dfs.items():
display(val.head(1))
我有一个数据帧字典 dict_of_dfs
。
我尝试两个显示每个数据集的第一行:
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
但这对我不起作用。
这也不return我输出pandas帧:
for dfName in dict_of_dfs.keys():
dict_of_dfs['dt_12'].head(1).to_string()
我假设您正在使用 Jupyter Notebook。您可以使用 IPython.display
.
display
函数
from IPython.display import display
for dfName, val in dict_of_dfs.items():
display(val.head(1))