【问题标题】:Pandas output in Jupyter notebook need full dataJupyter notebook 中的 Pandas 输出需要完整数据
【发布时间】:2019-12-25 19:56:07
【问题描述】:

我想查看 jupyter notebook 输出单元格中的完整数据。没有被 '...' 东西截断。

我想要完整的单元格数据

【问题讨论】:

  • 如果你用str() 投射那个东西会发生什么?您确定实际数据数据框中吗?
  • 也许您可以尝试使用.values 获取底层 NumPy 数组

标签: python pandas machine-learning jupyter-notebook data-science


【解决方案1】:

我认为它总是会向您显示截断的输出。
最好的解决方案是使用

df.to_excel("filename.xlsx")

它会生成数据框的 Excel 表格,然后您可以有效地查看它

【讨论】:

    【解决方案2】:

    Pandas 数据框 __repr__ just calls .to_string,接受 max_rowsmax_cols。这是您需要的:

    print(df.to_string(max_rows=float('inf'), max_cols=float('inf')))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-04-22
      • 2018-08-25
      • 1970-01-01
      • 2021-08-08
      • 2018-11-25
      • 1970-01-01
      • 2019-01-25
      • 1970-01-01
      相关资源
      最近更新 更多