NaN in Pandas: Why you need np.nan, not pd.NaN

NaN in Pandas: Why you need np.nan, not pd.NaN

Missing data? NumPy calls it nan. Python Pandas displays it as NaN.

But: Pandas doesn’t define pd.nan or pd.NaN. NumPy removed np.NaN in version 2.0.

So you have to refer to np.nan from within Pandas, and it’ll be displayed as NaN.