Graphing Multiple Variables Using Python and Seaborn/Pandas

Question:

I want to create a graph that combines these three variables. I want to do this so I can see if the team’s average win rating has an effect on the home crowd attendance. I have attached an image of what my data frame looks like. I am open to multiple graphs and would love to look at multiple different solutions for this if possible! Link to the data frame is here

Here is an example code to get you started. nba = pd.DataFrame([['Spurs', 18459.4, .741800], ['Thunder', 18203.0, 676800], ['Clippers', 19203.4, .662600], ['Warriors', 19403.6, .650000]], columns = ['Team', 'Home: Avg Attendance', 'Winning Percentage'])

Asked By: korny

||

Answers:

The graph function of pandas python package, allows you to create a composite graph with the number of spectators and the winning percentage. This is the simplest example.

nba.set_index('Team', inplace=True)

nba['Home: Avg Attendance'].plot(kind='bar')
nba['Winning Percentage'].plot(secondary_y=True, style='g', rot=90, figsize=(12,6)

enter image description here

Answered By: r-beginners
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.