After querying cosmos db I receive a ts column in my dataframe(df) which has datetime in the below format
df
_ts etag
1646255207 xyz
1646257427 abc
1646297798
1646333451 dfg
How do I convert this to a datetime format. The reason i want to is because, I only want data from last 24 hours.
I tried-
from datetime import datetime
d = "1646255207"
d = int(d[:10])
datetime.fromtimestamp(d).strftime('%Y-%m-%d %I:%M:%S %p')
Out[39]: '2022-03-02 04:06:47 PM'
Is there a better way to just add a filter to _ts and get last 24 hour data from _ts itself?