Solution 1:
Use pd.DataFrame.where
Uses df
value when condition is met, otherwise uses None
df.where(df.notnull(), None)
Use pd.DataFrame.where
Uses df
value when condition is met, otherwise uses None
df.where(df.notnull(), None)