Python Forum
Bar Chart - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Bar Chart (/thread-41306.html)



Bar Chart - James_S - Dec-17-2023

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


RE: Bar Chart - deanhystad - Dec-17-2023

Pandas DataFrame can plot a bar chart.


RE: Bar Chart - Axel_Erfurt - Dec-17-2023

These are not numbers but a mix of letters and numbers. How is that supposed to work?


RE: Bar Chart - James_S - Dec-17-2023

(Dec-17-2023, 11:19 AM)deanhystad Wrote: Pandas DataFrame can plot a bar chart.

Could you show me how?


RE: Bar Chart - James_S - Dec-18-2023

(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".


RE: Bar Chart - deanhystad - Dec-18-2023

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?