how to fill blank cell in pandas with na code example Example: pandas replace empty string with nan df = df.replace(r'^\s*$', np.NaN, regex=True)