pandas replace empty values to na code example
Example 1: pandas replace empty string with nan
df = df.replace(r'^\s*$', np.NaN, regex=True)
Example 2: python pandas replace nan with null
df.fillna('', inplace=True)
df = df.replace(r'^\s*$', np.NaN, regex=True)
df.fillna('', inplace=True)