Working with census data, I want to replace NaNs in two columns ("workclass" and "native-country") with the respective modes of those two columns. I can get the modes easily:
mode = df.filter(["workclass", "native-country"]).mode()
which returns a dataframe:
0 Private United-States
does not replace the NaNs in each column with anything, let alone the mode corresponding to that column. Is there a smooth way to do this?