在PyCharm的内置控制台中获得更广泛的输出 [英] Getting wider output in PyCharm's built-in console

查看:347
本文介绍了在PyCharm的内置控制台中获得更广泛的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对使用PyCharm IDE相对较新,并且在内置控制台会话中无法找到更好地塑造输出的方法。我通常使用相当宽的数据帧,可以很容易地放在我的显示器上,但是显示器正在切割和包装它们比需要的更快。

I'm relatively new to using the PyCharm IDE, and have been unable to find a way to better shape the output when in a built-in console session. I'm typically working with pretty wide dataframes, that would fit easily across my monitor, but the display is cutting and wrapping them much sooner than needed.

有没有人知道一个设置来改变这种行为,以利用我的屏幕的整个宽度?

Does anyone know of a setting to change this behavior to take advantage of the full width of my screen?

编辑:我没有足够的声誉发布截图,但链接在下面:
http://imgur.com/iiBK3iU

I don't have enough reputation to post a screenshot, but link is below: http://imgur.com/iiBK3iU

I想在几列之后阻止它包装(例如,'ReadmitRate'列应该紧靠'SNFDaysPerSNFCase'的右侧)

I would like to prevent it from wrapping after only a few columns (for example, the column 'ReadmitRate' should be immediately to the right of 'SNFDaysPerSNFCase')

推荐答案

看来我错误地认为问题是PyCharm中的问题(例如,在设置或偏好中可以解决)。它实际上与控制台会话本身有关。控制台尝试自动检测显示区域的宽度,但是当失败时,它默认为80个字符。可以使用以下方式覆盖此行为:

It appears I was mistaken in thinking that the issue was one in PyCharm (that could be solved, for example, in a setting or preference.) It actually has to do with the console session itself. The console attempts to auto-detect the width of the display area, but when that fails it defaults to 80 characters. This behavior can be overridden with:

import pandas as pd
desired_width = 320    
pd.set_option('display.width', desired_width)

您可以在哪里设置 desired_width 到您的显示器可以容忍的任何内容。
感谢@TidB提出的建议,即我最初的关注点并未集中在正确的区域。

Where you can of course set the desired_width to whatever your display will tolerate. Thanks to @TidB for the suggestion that my initial concern wasn't focused in the right area.

这篇关于在PyCharm的内置控制台中获得更广泛的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆