0

I'm curious if it's possible to convert NaT values to None values in Pandas 1.3. A script I had running is now breaking with the update and it seems like everything I've tried has been unsuccessful in converting these values. I've tried

df['time'] = df['time'].apply(lambda x: None if x!=x else x)
df = df.where(df.notnull(), None)

This is causing issues when writing to Postgres using the upsert_dict_list methodology.

Thoughts?

Rafa
  • 1
  • This post, https://stackoverflow.com/questions/42818262/pandas-dataframe-replace-nat-with-none, makes it seem like you have to convert the column to an object so you would lose the datetime properties of the column. I've tried a few different things on my end and it always converts `date` to an object. – miguelf88 Jul 21 '21 at 20:11

0 Answers0