我是Python新手,
我知道这个价格:1304.20-1500.20-4.10-140.50
如何删除逗号?你知道吗
for open_price in df_open:
if ',' in open_price:
open_priceClean = open_price.replace(',', '')
continue
prices.append(float(open_priceClean))
我得到这个警告:
TypeError
Traceback (most recent call last) <ipython-input-67-80afd251c13d> in <module>()
10 #Create the dependent data set 'y' as prices
11 for open_price in df_open:
---> 12 if ',' in open_price:
13 open_priceClean = open_price.replace(',', '')
14 continue
TypeError: argument of type 'float' is not iterable
试试这个:
相关问题 更多 >
编程相关推荐