【发布时间】:2015-07-11 10:55:48
【问题描述】:
问题:如何从 1 个 iPython Notebook 行一起打印 2 个 DataFrame 表,从而使两个表都以漂亮的表格格式显示?
以下仅打印第二个,print df.head() 不会生成漂亮的表格。
df = pd.DataFrame(np.random.randn(6,4), index=pd.date_range('20150101', periods=6), columns=list('ABCD'))
df2 = pd.DataFrame(np.random.randn(6,4), index=pd.date_range('20150101', periods=6), columns=list('WXYZ'))
df.head()
df2.head()
以下内容不会生成所需的漂亮表格:
print df.head()
print df2.head()
【问题讨论】:
-
你想在这里得到最底层的答案吗:stackoverflow.com/questions/28966780/… 如果是这样,我将作为重复关闭
-
df.head(), df2.head()
-
或者你可以使用
print -
@joris
print df.head()不会生成漂亮的表格 -
或
from IPython.display import display,然后使用display(df.head())
标签: python pandas ipython ipython-notebook