0

I am receiving an error while dividing two columns value in a dataframe. This is the code:

df['lose%'] =  df['LostGames']/ df['PlayedGames']

This is my error:

TypeError: unsupported operand type(s) for /: 'str' and 'str'

Can anyone help me with this ??

John Conde
  • 217,595
  • 99
  • 455
  • 496

1 Answers1

0

df1.WonGames = pd.to_numeric(df1.WonGames)

df1.LostGames = pd.to_numeric(df1.LostGames)

df1.PlayedGames = pd.to_numeric(df1.PlayedGames)