Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bar Chart
#1
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
Reply
#2
Pandas DataFrame can plot a bar chart.
Reply
#3
These are not numbers but a mix of letters and numbers. How is that supposed to work?
Reply
#4
(Dec-17-2023, 11:19 AM)deanhystad Wrote: Pandas DataFrame can plot a bar chart.

Could you show me how?
Reply
#5
(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".
Reply
#6
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?
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020