繁体   English   中英

jupyter notebook 中的打印顺序

[英]Order of printing in jupyter notebook

我的代码很简单

df['col'].hist(bins = 250)
df['col'].value_counts()

我不明白的是,我的 Jupyter 笔记本中的 output 以相反的顺序出现。

在此处输入图像描述

如果我将订单更改为

df['col'].value_counts()
df['col'].hist(bins = 250)

然后只出现直方图。

我不明白什么?

hist() 显示视觉图形,而 value_count() 显示文本 output。 除非另有说明,否则视觉数据会在 jupyter 单元中的文本数据之后加载。

在 hist 之后添加plt.show()以刷新您的 window 并在此之前显示视觉 plot。

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM