I want to fill nan values using some linear regression model. I use other columns that are not nan and I compute the one that is NaN.
Now, I have a problem to change the following value.
I have an array nan_values_predicted
and the indexes of these values in the main dataset.
But I can't find a way to change the exact data point.
I tried something like:
df.loc[index_1]['feature_1'] = df.loc[index_1]['feature_1'].fillna(predicted_feature_1)
and many other variations, a bit smarter than this one but they don't work. Any help?
I was missing this...
as opposed to doing df.loc[index_1]['feature_1'] = some_value
I should've done df.loc[index_1, 'feature_1'] = some_value
And everything works now