I have a two million timestamp data. I am trying to find first and last date that to in the YYYY-MM-DD
format so I can use them in saving file name. But, I found out that np.unique(df.index)
is fast (10s) and produces dates in the
datetime.date(2022, 6, 7)
format but df.index.strftime('%Y-%m-%d').unique()
gives the output I want but it takes more than 5 min, which is bad. So, I decided to use the former approach.
So, How do I convert something like datetime.date(2022, 6, 7)
to'2022-06-07'
?