pandas 在 ipython 中绘图时抑制对象的输出

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14506583/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 20:36:47  来源:igfitidea点击:

Suppress output of object when plotting in ipython

pandasipython

提问by aozkan

Is it possible to suppress the array output when plotting a histogram in ipython?:

在 ipython 中绘制直方图时是否可以抑制数组输出?:

For example:

例如:

plt.hist(theitroad['Range'], bins, named=True, histtype='bar')

outputs/prints the array information before displaying the graph.

在显示图形之前输出/打印数组信息。

ipython histogram

ipython直方图

回答by weiz

just put ;after the code.
It works only in ipython-notebook.

;代码放在后面。
它仅适用于 ipython-notebook。

plt.hist(...);

plt.hist(...);

回答by NPE

Assign the return value to a variable (which I call _to indicate it's unused):

将返回值分配给一个变量(我调用_它表示它未使用):

_ = plt.hist(...)

回答by user3114859

You can also add plt.show():

您还可以添加plt.show()

plt.hist(theitroad['Range'], bins, named=True, histtype='bar')
plt.show()