how to replace empty string with nan in pandas code example
Example 1: replace "-" for nan in dataframe
df.replace(np.nan,0)
Example 2: pandas replace empty string with nan
df = df.replace(r'^\s*$', np.NaN, regex=True)
df.replace(np.nan,0)
df = df.replace(r'^\s*$', np.NaN, regex=True)