Lets say I have the following dataframe:
fix_id lg home_team away_team
9887 30 Leganes Alaves
9886 30 Valencia Las Palmas
9885 30 Celta Vigo Real Sociedad
9884 30 Girona Atletico Madrid
and I run an apply function over all the rows of the dataframe. The output of the apply function is the following pandas series:
9887 ({'defense': '74', 'midfield': '75', 'attack': '74', 'overall': '75'},
{'defense': '74', 'midfield': '75', 'attack': '77', 'overall': '75'}),
9886 ({'defense': '80', 'midfield': '80', 'attack': '80', 'overall': '80'},
{'defense': '75', 'midfield': '74', 'attack': '77', 'overall': '75'}),
...
How could add the output dictionaries as new columns to my dataframe. I want to add all eight of them to the same row.
I will be glad to get any guidance. Not necessarily a code. Maybe just instruct me how to, and I will try?
Thanks.