in

Python : ValueError: could not convert string to float: ‘1,086’


I’ve been learning how to make a prediction model by looking at this step-by-step tutorial website: https://towardsdatascience.com/step-by-step-guide-building-a-prediction-model-in-python-ac441e8b9e8b

The data I was using are the Covid-19 cases in Peru from last Jan to this Sep, and with this data, I want to predict death cases from this Oct to Dec.
However, the “New Cases” data type can not be converted to float. So, I added this:

df = df.replace(r'^s*$', np.nan, regex=True)
But it did not work too… What should I do?

df = df[['Date', 'New Cases']]
df.head()

df = df.replace(r'^s*$', np.nan, regex=True)
df = df.astype({"New Cases": float})
df["Date"] = pd.to_datetime(df.Date, format="%Y/%m/%d")
df.dtypes
df.index = df['Date']
plt.plot(df["New Cases"],label="2020/1/1~2021/9/30 New Cases")`



Source: https://stackoverflow.com/questions/70538715/python-valueerror-could-not-convert-string-to-float-1-086

BSNL, Jio Providing New Offers on Annual Plans

a tool used to quickly generate stimuli souces of hspice format