英文:
How to increase Google Colab cell output width?
问题
我找到一个非常相似的问题,但解决方案在Google Colab上不起作用。我想更好地查看我的pandas数据框列中的文本。目前,默认宽度似乎为50%。
from IPython.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))
display(HTML("<style>.output_result { max-width:100% !important; }</style>"))
作为替代,我找到了一个名为Data Tables的扩展。这可能是目前可用的最佳解决方案,但似乎只适用于表格。
from google.colab import data_table
data_table.enable_dataframe_formatter()
英文:
I found a very similar question but the solution did not work on Google colab. I would like to see better the text in my pandas dataframes columns. Right now the default width seems 50%.
from IPython.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))
display(HTML("<style>.output_result { max-width:100% !important; }</style>"))
As an alternative, I found an extension called Data Tables. This may be the best solution available today for it but seems to only works for tables.
from google.colab import data_table
data_table.enable_dataframe_formatter()
答案1
得分: 3
能够在Colab中增加pandas的显示输出,使用以下代码:
import pandas as pd
pd.set_option('display.width', 180)
英文:
Was able to increase pandas display output in Colab using:
import pandas as pd
pd.set_option('display.width', 180)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论