0

I need to create a vector of dates from 2018-01-01 to 2020-01-01, the vector can not be continuous (eg 2018-01-01, 2018-01-02, 2018-01-03 ...), dates need not be symmetrical and include the head and the tail.

The closest I got was:

import pandas as pd
date_list = pd.date_range(start='2018-01-01', end='2020-01-11', freq = '3M', closed= 'left')
date_list
Out[3]: 
DatetimeIndex(['2018-01-31', '2018-04-30', '2018-07-31', '2018-10-31',
           '2019-01-31', '2019-04-30', '2019-07-31', '2019-10-31'],
          dtype='datetime64[ns]', freq='3M')

However, it does not include the head (2018-01-01) or the tail (2020-01-01).

Márcio Mocellin
  • 274
  • 5
  • 18

0 Answers0