pd.read excel read cells with only spaces as nan not as string code example Example: pandas replace empty string with nan df = df.replace(r'^\s*$', np.NaN, regex=True)