#Bar Graph
86 messages · Page 1 of 1 (latest)
You might want to look into the pandas and matplotlib libraries
Sorry, would you mind explaining what that means, when it comes to coding I am a feotus
Um, I know how to do addition and stuff
And print
And also how to load files
Like the CSV stuff
I just get stuck whenever I try to do graphs, like information like this:
I just want to go the Y axis be Frequency and then the X axis be Male and Female but I have no clue how I go about doing that without it looking like one big blob
Have you tried any code so far?
Yes I have
I know about lexis files, pandas and currently I'm working on networking
I just get confused by working on graphs 😦
Also thanks for responding I thought everyone was just gonna ignore my question 😄
No worries lol, this is my field of expertise
If you know about pandas, have a look at matplotlib
Matplotlib will allow you to make the plots you want
Okay, I know of pandas but I'm not very good at using it, how do I look at matplotlib, is it a place?
Google it
It's a library like pandas
Actually, if you just want a rough plot, you can directly use pandas I think
Okay, how do I use pandas, is it a command I have to put in?
I thought pandas was what they called the graphs
Yeah sorry I'm really bad at this ;-;
The course I took was coding from nothing to basic but the professor has just skyrocketed in teaching and everything makes no sense to me
So that's why I'm asking for help
Pandas is a python library, which in other words is a collection of code that has been written by other people that you can use. What pandas is good at is tabular data, so like the spreadsheets you use in excel
Ah yes I have excel that's what the information I'm using is on
Pandas has functions to read in tabular data files like csv or xlsx files into something called a data frame. This data frame is similar to what you see in excel. From this data frame, you can apply things to it to do what you want like plotting a certain column's data
Maybe, I assume that's what you've called your data frames
mhm
When I click on them in spyder it displays the information from the CSVs
Excel, or whatever they're called
Yay 😄
Do you know how to select a series i.e. a column from your data frame?
How would one do that?
It'll be like dataframename["column_name"]
Where obviously you use the data frame and column names you have/want
Okay, and that would select that column?
Try it and see what you get
What do you think? Does that look like the column you want
Well it's the column that says 1s and 0s: 1 Meaning they are female and 0 meaning that they are male
And I believe that those numbers on the left is a count ? From 0 to the max amount?
Ah thank you, so yes this is the column out of the information I wish to select
You don't put anything in
Put them together
Oh facts
Well it seems like by default it plotted a line graph
Do .plot(kind="bar") instead
Hopefully it should give you a bar plot
Wtf
Okay, I see, what I wanted it to do is to plot 'Male' and 'Female' and then on the Y axis it says 'Frequency'