【问题标题】:Histogram grouping customization直方图分组定制
【发布时间】:2020-11-08 12:25:21
【问题描述】:

下面我正在分享我的数据框,我正在尝试获取一个按集群分隔的 Count x Name 直方图,但没有成功。

df_result2
cluster Name    Count
0   0   dlInformationTransfer   270769.0
1   0   measurementReport   2154170.0
2   0   rrcConnectionReconfiguration    1857067.0
3   0   rrcConnectionReconfigurationComplete    1856250.0
4   0   rrcConnectionReestablishment    1077.0
5   0   rrcConnectionReestablishmentComplete    1073.0
6   0   rrcConnectionReestablishmentReject  252.0
7   0   rrcConnectionReestablishmentRequest 1328.0
8   0   rrcConnectionRelease    538334.0
9   0   rrcConnectionRequest    538411.0
10  0   rrcConnectionSetup  538411.0
11  0   rrcConnectionSetupComplete  538089.0
12  0   ueCapabilityEnquiry 345093.0
13  0   ueCapabilityInformation 345048.0
14  4   dlInformationTransfer   86563.0
15  4   measurementReport   554468.0
16  4   rrcConnectionReconfiguration    566628.0
17  4   rrcConnectionReconfigurationComplete    566251.0
18  4   rrcConnectionReestablishment    179.0
19  4   rrcConnectionReestablishmentComplete    177.0
20  4   rrcConnectionReestablishmentReject  31.0
21  4   rrcConnectionReestablishmentRequest 211.0
22  4   rrcConnectionRelease    155589.0
23  4   rrcConnectionRequest    155781.0
24  4   rrcConnectionSetup  155782.0
25  4   rrcConnectionSetupComplete  155654.0
26  4   ueCapabilityEnquiry 91814.0

我正在尝试按集群对每个“名称”的体积进行分组,但我的 Y 轴显示为 1,我想绘制计数 x 名称。 我应该如何更改我的直方图调用?

df_result2.hist(column='Name', by='cluster', bins=10, grid=True, figsize=(20,10))

enter image description here

【问题讨论】:

    标签: python pandas plot histogram


    【解决方案1】:

    你需要绘制条形图而不是直方图

    new_df.groupby('cluster').plot(x="Name", y=["Count"], kind="bar", grid=True, figsize=(20,10), ylim=(0,2500000.0))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-02-03
      • 2021-10-16
      • 2018-02-06
      • 1970-01-01
      • 1970-01-01
      • 2021-10-24
      • 1970-01-01
      相关资源
      最近更新 更多