简体   繁体   中英

Error while dividing two columns value in a dataframe

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??

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

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

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


The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM