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!
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'])
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)
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!
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'])
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)