StartUp Me
StartUp Me

Reputation: 11

Histogram grouping customization

Below I'm sharing my dataframe and I'm trying to get a Count x Name histogram separated by cluster but not successfully.

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

I'm trying to group by Cluster the volume of each 'Name', but my Y axis is showing 1 and I`d like to plot Count x Name. How should I change my histogram calling?

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

enter image description here

Upvotes: 1

Views: 39

Answers (1)

Atul
Atul

Reputation: 688

You need to plot bar graph and not histogram

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

Cluster 0

Cluster 4

Upvotes: 1

Related Questions