Question

const averageRating numVotes Sex Year 0 0015724 6.2 19 Women 1993 1 0035423 6.4 72338 Men...

    const  averageRating  numVotes    Sex       Year 
0       0015724            6.2        19    Women     1993
1       0035423            6.4     72338    Men       2001
2       0059900            6.8        21    Women     2018
...           ...            ...       ...      ...    ...
121314  9190404            9.9         7    Women     2019
121315  9209662            7.8         8    men       1999
121316  9226154            1.5        97    men       1986

This is a data table that showing average rate, sex, and year. And I want to see how average rating is

difference depends on musician's sex.

I'm supposed to use Pandas DataFrame in Python.

So, x-axis will be years and y-axis will be averageRating.

I want to make two lined graph one for women and one for men.

Plz help me how to populate each each gender and plot on corresponding datas.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#source code:

st.csv pur py receipt.tod import matplotlib.pyplot as plt 2 import pandas as pd data-pd.read csv (1ist.CSV) 4 p-data.groupb

#source code in plain text:

import matplotlib.pyplot as plt
import pandas as pd
data=pd.read_csv("list.csv")
p=data.groupby("sex")
men=p.get_group("Men")
women=p.get_group("Women")
plt.plot(men["years"],men["averageRating"])
plt.plot(women["years"],women["averageRating"])
plt.xlabel("Years")
plt.ylabel("averageRating")
plt.show()

#list.csv file

CAUsers vishnuDesktop list.csv- Notepad++ File Edit Search View Encoding Language Settings Tools Macro Run Plugins Window r b

#list.csv in plain text:

const,averageRating,numvotes,sex,years
0015724,6.2,19,Women,1993
0035423,6.4,72338,Men,2001
0059900,6.8,21,Women,2018
9190404,9.9,7,Women,2019
9209662,7.8,8,Men,1999
9226154,1.5,97,Men,1986

#output:

CaUsers vishnuDesktop store.py - Notepad++ File | ⓚ Figure 1 nv py 10 8 1.0 4 1985 1990 1995 2000 2005 2010 2015 2020 Years

#if you have any doubts comment below...

Add a comment
Know the answer?
Add Answer to:
const averageRating numVotes Sex Year 0 0015724 6.2 19 Women 1993 1 0035423 6.4 72338 Men...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT