I have a data set in which there is a column known as Native Country which contain around 30000 records. Some are missing represented by NaN so I thoug
30000
NaN
Try something like: fill_mode = lambda col: col.fillna(col.mode()) and for the function: new_df = df.apply(fill_mode, axis=0)
fill_mode = lambda col: col.fillna(col.mode())
new_df = df.apply(fill_mode, axis=0)