Select all data with a value of 0 in the dataframe and replace it with nan
df[df == 0] = np.nan
Select all data with the value of nan in the dataframe and replace with 0
df.fillna(0)
Select all data with a value of 0 in the dataframe and replace it with nan
df[df == 0] = np.nan
Select all data with the value of nan in the dataframe and replace with 0
df.fillna(0)