如何从pandas数据框架中可视化单列的数据

问题描述 投票:0回答:1

我是数据科学& pandas的新手。 我只是想可视化一个系列的数据分布(单列),但我生成的直方图只有一列(见下图降序排列)。

我的数据有1100多万行。最大值是27235,最小值是1。 我想看到 "count "列被分组为不同的bin和一个列条,其高度是每个bin的总数。 但是,我只看到一个单条,不知道该怎么做。

enter image description here

enter image description here

pandas matplotlib histogram
1个回答
0
投票

数据

df = pd.DataFrame({'count':[27235,26000,25877]})

解决办法

import matplotlib.pyplot as plt
df['count'].hist()

enter image description here

或者

sns.distplot(df['count'])
© www.soinside.com 2019 - 2024. All rights reserved.