我只有一列,我试图在行值中添加“,”,但总是
遇到错误,“需要一个整数”
df = df['Cntr_Number'] + ','
print(df['Cntr_Number'].astype(str))
答案 0 :(得分:1)
尝试一下:
df.loc[:,'Cntr_Number'] = df.Cntr_Number.apply(lambda x: str(x)+',')
答案 1 :(得分:1)
您应该将列强制为str
类型:
df['Cntr_Number'] = df['Cntr_Number'].as_type('str') + ','