I want to plot a bar chart for a list of items. It is a list of string names with frequencies (int) The list is quite long, so I can not manually edit it.
[] 4291017
['a'] 221943
['b'] 121027
['d'] 100915
['c'] 54344
['g'] 33486
The above was an output of the following command: names = df['names'].explode().value_counts().head(N)
The plot command that I am using is:
names.plot(kind='barh')
How can I plot it for all the values except for the first one, which is basically an empty field? The problem is that I cannot drop it as it is not NaN.
CodePudding user response:
Quick and dirty:
names = df['names'].explode().value_counts().iloc[1:]
will remove the first line ([]
)