python - What is the difference between NaN and None? - Stack Overflow

PHOTO EMBED

Thu Mar 31 2022 23:35:55 GMT+0000 (Coordinated Universal Time)

Saved by [deleted user] #python

#  without forcing dtype it changes None to NaN!
s_bad = pd.Series([1, None], dtype=object)
s_good = pd.Series([1, np.nan])

In [13]: s_bad.dtype
Out[13]: dtype('O')

In [14]: s_good.dtype
Out[14]: dtype('float64')
content_copyCOPY

https://stackoverflow.com/questions/17534106/what-is-the-difference-between-nan-and-none