empty to nan pandas code example
Example 1: pandas replace nan
data["Gender"].fillna("No Gender", inplace = True)
Example 2: pandas replace empty string with nan
df = df.replace(r'^\s*$', np.NaN, regex=True)
data["Gender"].fillna("No Gender", inplace = True)
df = df.replace(r'^\s*$', np.NaN, regex=True)