1

I have this following dataframe:

enter image description here

And i have this following list:

enter image description here

and i want to replace the series value of team_stat['First Half']['W'] to the list value of first_half_win_result

enter image description here

slothfulwave612
  • 1,349
  • 9
  • 22
  • Possible duplicate of [Add column in dataframe from list](https://stackoverflow.com/questions/26666919/add-column-in-dataframe-from-list) – Aaron_ab Oct 11 '19 at 08:53

2 Answers2

1

Try the following code, it would convert list to series for pandas

team_stat['First Half']['W'] = pd.Series(first_half_win_result)
oreopot
  • 3,392
  • 2
  • 19
  • 28
1

well i find the solution:

   team_stat = team_stat.transpose()
   team_stat.loc['First Half', 'W'] = first_half_win_result
   team_stat = team_stat.transpose()
slothfulwave612
  • 1,349
  • 9
  • 22