I am trying to create a list L of dates from '2020-01-22' to '2020-01-25' (very small example...). So I expect to get:
print(L)
['2020-01-22', '2020-01-23', '2020-01-24', '2020-01-25']
I used (because I thought it was enough):
import pandas as pd
from datetime import datetime
L = pd.date_range(start='2020-01-22',end='2020-01-25').tolist()
But this gives me:
[Timestamp('2020-01-22 00:00:00', freq='D'),
Timestamp('2020-01-23 00:00:00', freq='D'),
Timestamp('2020-01-24 00:00:00', freq='D'),
Timestamp('2020-01-25 00:00:00', freq='D')]
I really have a problem understanding how datetime works; should I import something else? What would be a proper simple coding to have in my list just the dates '2020-01-22', etc. in that precise format?
list(pd.date_range(start='2020-01-22',end='2020-01-25').strftime('%Y-%m-%d'))