如何将“,”替换为“”?如何删除值中的逗号?

How to replace "," with ""? How can I delete the comma in my values?

我的意思是我有一个名为 num_students.

的列

它的数据类型是object,例如写成2,435

我想把它作为对象获取为2435

我想做的是:

timesData.num_students = [ each.replace(",","") for each in timesData.num_students]

我收到错误: AttributeError: 'float' 对象没有属性 'replace'

使用 str.replace

的一种方法
timesData['num_students'] = timesData['num_students'].str.replace(',', '')

str.replace(',', '') replaces the comma with nothing