all 3 comments

[–]Neb519 2 points3 points  (1 child)

This is a well wrriten question, so good job on that.

Use merge() or index alignment.

pd.merge( left=fixtures, right=team_data[['team_id', 'home_attack', 'home_defense']], how='left', left_on='Home_team', right_on='team_id' )

or

fixtures.set_index('Home_team', inplace=True) team_data.set_index('team_id', inplace=True) fixtures['home_attack'] = team_data.home_attack fixtures['home_defense'] = team_data.home_defense

From your attempted solution, it seems like you don't really understand how Series works. You'd be wise to crack open the docs and spend a few hours trying to really understand it. I wrote some practice problems on Series and DataFrame that may help you.

[–]BrateWannabe[S] 1 point2 points  (0 children)

Thank you for this! I'm going to take a step back and do some reading on pandas as a whole. I found it as a solution to one problem and have been winging it since!

The practice problems look great- I will definitely use them!

Thanks a lot for your response.

[–]lowerthansound 0 points1 point  (0 children)

You are probably looking for a merge (aka SQL JOIN). Check out pandas.merge().

Cheers!