Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Unable to convert objects into float type

for i in range(1, len(forecast_data)):
   forecast_data.loc[i, 'lag_gov'] = np.where(forecast_data.loc[i, 'DATE']<=last_actuals, forecast_data[i-1, 'gov_actual'], forecast_data.loc[i-1, 'gov_fcst'])
forecast_data.loc[i, 'lag_gov'] = pd.to_numeric(forecast_data.loc[i, 'lag_gov'], errors='coerce')

But the code is unable to convert the forecast_data.lag_gov to float. The result still shows it as an object.

Comments