Python Error : Typeerror: Object Of Type 'timestamp' Is Not Json Serializable'
I have a Dataframe that has a time stamp column of type 'datetime64[ns]'. When I try to insert it to Salesforce platform get an error 'TypeError: Object of type 'Timestamp' is not
Solution 1:
You can try convert datetime to string:
df['Date'] = df['Date'].astype(str)
Or:
df['Date'] = df['Date'].dt.strftime('%Y-%m-%d %H:%M:%S')
print (df.dtypes)
Id object
Name object
Date objectTypeobject
dtype: object
Post a Comment for "Python Error : Typeerror: Object Of Type 'timestamp' Is Not Json Serializable'"