Python Forum

Full Version: Bar Chart
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How to draw a bar chart of the column "CC" from a my.csv file (show below) to count occurrence in ascending order?

32, AA,BB,CC,DD,EE
41,monkey,dog,horse,horse,cat
54,zebra,bird,cat,monkey,cat
44,bird,bird,dog,dog,monkey
43,horse,donkey,dog,zebra,bird
54,horse,horse,zebra,bird,bird
52,donkey,zebra,horse,cat,zebra
59,bird,donkey,horse,monkey,whale
40,cat,cat,horse,bird,whale
49,donkey,donkey,bird,monkey,whale
84,cat,donkey,whale,bird,zebra
48,whale,monkey,cat,donkey,zebra
87,horse,cat,zebra,bird,monkey
41,whale,bird,cat,bird,cat
Pandas DataFrame can plot a bar chart.
These are not numbers but a mix of letters and numbers. How is that supposed to work?
(Dec-17-2023, 11:19 AM)deanhystad Wrote: [ -> ]Pandas DataFrame can plot a bar chart.

Could you show me how?
(Dec-17-2023, 08:17 PM)Axel_Erfurt Wrote: [ -> ]These are not numbers but a mix of letters and numbers. How is that supposed to work?

Sorry for the confusion.
I just clarified in the original statement.
I want to know how to draw bar chart to count the occurrence of entries in the column under "CC".
Sounds like you want to count things. Pandas can groupyby the values in a column and count the number of items in each group. Do you need the bar chart to display 0 for animals that are not in AA?