Replace any number of white spaces with pd.NA (null)

PHOTO EMBED

Wed Jul 05 2023 18:50:05 GMT+0000 (Coordinated Universal Time)

Saved by @jmbenedetto #python

df.replace(r'^\s*$', pd.NA, regex=True)
content_copyCOPY

https://stackoverflow.com/questions/13445241/replacing-blank-values-white-space-with-nan-in-pandas