0

I'm very new to Python, and practising with two different dataframe. While .fillna() function worked perfectly to 1st dataframe, and replaced all the NaN Values to median as intended, but shockingly the same function did not work to the 2nd dataframe and still having all the NaN values. furthermore, both columns have float64 datatype. Here is the code I wrote-

median_age = dataframe['age'].median()
print('median',median_age)
dataframe['age'].fillna(median_age, inplace = True)

Is there any chance I got two different type of 'NaN' values in two different dataset? if so what is it and how it can be dealt with? Any suggestion will help and will be much appreciated. Thanks

S. Mandal
  • 71
  • 9
  • [Don't use inplace=True, assign it back instead](https://stackoverflow.com/questions/43893457/understanding-inplace-true/59242208#59242208) - see the caveats section, inplace=True does not always work due to the settingWithCopy problem, `dataframe['age'] = dataframe['age'].fillna(median_age)` – cs95 Jun 07 '20 at 22:34
  • Show us the contents of the dataframe column. https://stackoverflow.com/help/mcve – J_H Jun 07 '20 at 22:36
  • Unfortunately it did not work, still having NaN values in the dataframe – S. Mandal Jun 08 '20 at 14:36

0 Answers0