I have a python pandas dataframe that should print with the following line:
close.loc[stock, str(j)+'_days_ago'] = float(stocks.iloc[[-1 - j]]['Close'].to_string(header=None, index=None))
yet I get the following error:
ValueError: could not convert string to float: '1,971.25'
Any ideas how to fix this error?
df['column_name'].str.replace(',', '')