pandas dataframe遍历时数据类型为float无法遍历
作者:互联网
报错:TypeError: 'float' object is not subscriptable
https://www.delftstack.com/zh/howto/python-pandas/how-to-convert-float-to-int-in-pandas-dataframe/
转化为int之后,再用列表填充,遍历列表
k2 = pd.to_numeric(stock_a_all_pb_df.values[-1, 1:], downcast='integer')
i2 = []
for p2 in k2:
i2.append(p2)
标签:i2,int,float,数据类型,dataframe,k2,pandas 来源: https://www.cnblogs.com/xingnie/p/16098810.html