pandas fillna with median of column
df['X'].fillna(df['X'].median(), inplace=True)
Here is what the above code is Doing:
1. We’re filling the missing values in the X column with the median of the X column.
2. We’re filling the missing values in the Y column with the median of the Y column.
3. We’re filling the missing values in the Z column with the median of the Z column.