pandas – How to convert timestamp into string in Python
pandas – How to convert timestamp into string in Python
Can you coerce the data type to a string to perform this calculation?
date_time_obj = datetime.strptime(str(date), %Y-%m-%d %H:%M:%S)
If it says strptime() argument 1 must be str, not Timestamp, likely that you already have the pandas.Timestamp
object, i.e., it is not a string but a parsed date time, only it is in Pandas format, not Pythons. So to convert, use this:
date_time_obj = date.to_pydatetime()
instead of date_time_obj = datetime.strptime(date, %Y-%m-%d %H:%M:%S)