【问题标题】:How do I display more than one pandas describe() output in a single jupyter cell?如何在单个 jupyter 单元格中显示多个 pandas describe() 输出?
【发布时间】:2021-03-08 06:45:18
【问题描述】:

这是一个非常基本的问题,但我无法找到答案:

在 Jupyter 中,如果我在同一个单元格中执行两个 pandas df.describe() 调用,则只显示最后一个的输出。 .info().head() 等也是如此。

我如何说服 Jupyter 和 pandas 按预期顺序显示上述输出中的所有N,并使用与单个输出默认相同的表格格式?

FWIW 示例代码为:

df1.describe()
#...
df2.describe()
dfN.describe() # Only the result of the final call is displayed

来自 cmets 的点:

  1. print(df1.describe()) 可以工作,但不会像 describe() 本身一样呈现表格。

  2. 显示两个 pandas 表并排 (Jupyter notebook display two pandas tables side by side) 可能有效,但不能扩展到N 表。

【问题讨论】:

标签: python pandas jupyter jupyter-lab


【解决方案1】:

您可以configure您当前的会话并指定InteractiveShell.ast_node_interactivity要显示的值:

%config InteractiveShell.ast_node_interactivity = 'all'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-13
    • 2013-09-20
    • 1970-01-01
    • 2015-04-30
    • 1970-01-01
    相关资源
    最近更新 更多