How do you fill missing values in Pandas with mode? code example
Example: fill na with mode and mean python
cateogry_columns=df.select_dtypes(include=['object']).columns.tolist()
integer_columns=df.select_dtypes(include=['int64','float64']).columns.tolist()
for column in df:
if df[column].isnull().any():
if(column in cateogry_columns):
df[column]=df[column].fillna(df[column].mode()[0])
else:
df[column]=df[column].fillna(df[column].mean)