【发布时间】:2021-06-21 12:52:29
【问题描述】:
我在分割数据框中的两列值时收到错误消息。这是代码:
df['lose%'] = df['LostGames']/ df['PlayedGames']
这是我的错误:
TypeError: /: 'str' 和 'str' 的操作数类型不受支持
谁能帮我解决这个问题??
【问题讨论】:
标签: pyldavis
我在分割数据框中的两列值时收到错误消息。这是代码:
df['lose%'] = df['LostGames']/ df['PlayedGames']
这是我的错误:
TypeError: /: 'str' 和 'str' 的操作数类型不受支持
谁能帮我解决这个问题??
【问题讨论】:
标签: pyldavis
df1.WonGames = pd.to_numeric(df1.WonGames)
df1.LostGames = pd.to_numeric(df1.LostGames)
df1.PlayedGames = pd.to_numeric(df1.PlayedGames)
【讨论】: