如图,我生成了一个dataframe
我希望最后生成的图片是这样的:
提示数据类型是字符串型,可以用db.info()查看一下数据类型,并对不是float数据类型数组用astype(float)转换
db= db.applymap(lambda x: str(int(x)) if int(
str(x).split('.')[-1]) == 0 else round(x, 3))
print(df)
print(db)
报错了'type str doesn't define __round__ method'