pandas - IPython/pandas 中的格式问题

标签 pandas string-formatting jupyter-notebook

希望我希望使用 pandas 和 IPython 返回一些我想要复制和粘贴的 HTML 嵌入代码。

问题是输出被裁剪。如何更改设置才能看到完整的结果?

这是一个例子:

<h2>Evil Trent</h2><iframe width="560" height=...

如果我使用 df.ix[0] 选择单个元素,您可以看到完整的结果。

<h2>Evil Trent</h2><iframe width="560" height="315" src="//www.youtube.com/embed/qvX8cfMUPqg" frameborder="0" allowfullscreen></iframe><p>Published by Evan Leonard on Monday August 05.</p>

我想要的是查看其余的输出。这是 Chrome 上 IPython 的简单设置问题吗?

最佳答案

尝试将 option.display.max_colwidth 设置为更大的值:

In [11]: df
Out[11]:
                                                   0
0  <h2>Evil Trent</h2><iframe width="560" height=...

In [12]: pd.options.display.max_colwidth
Out[12]: 50

增加到 200 似乎就可以了:

In [13]: pd.options.display.max_colwidth = 200

In [14]: df
Out[14]:
                                                                                                                                                                                              0
0  <h2>Evil Trent</h2><iframe width="560" height="315" src="//www.youtube.com/embed/qvX8cfMUPqg" frameborder="0" allowfullscreen></iframe><p>Published by Evan Leonard on Monday August 05.</p>

参见"working with package options" section of the docs .

关于pandas - IPython/pandas 中的格式问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18067587/

相关文章:

python - 如何使用python选择前X列和后Y列

python - 在 Pandas 中重命名列名

string-formatting - sprintf_s中的格式控制说明符%016I64X是什么意思

python - 如何输出从列表中查找最大频率值的字典?

jupyter-notebook - 是否有 Jupyterlab 的所有可用扩展的列表?

jupyter-notebook - MethodError:没有方法匹配/(::Int64,::typeof(r)) [Julia]

python - 将多个 if/else 语句应用于 pandas 中的 groupby 对象

Python过滤单个数据框列中的数字和字符串

wpf - 绑定(bind)字符串格式

.net - 将 C++ printf 格式与 VB .NET 字符串格式相互转换