# www.pd.date_range

```>>> pd.date_range(start='1/1/2018', periods=5, freq='3M')
DatetimeIndex(['2018-01-31', '2018-04-30', '2018-07-31', '2018-10-31',
'2019-01-31'],
dtype='datetime64[ns]', freq='3M')
```

Here is what the above code is Doing:
1. start=’1/1/2018′ – We’re telling Pandas to start the range at January 1st, 2018.
2. periods=5 – We’re telling Pandas to create 5 periods.
3. freq=’3M’ – We’re telling Pandas to create periods at an interval of 3 months.

The output is a DatetimeIndex with 5 periods.

Note that the first period starts at January 31st, 2018. This is because the first period is 3 months long, and the start of the first period is the last day of the first month.

If you want to create a range of dates that starts at the beginning of the month, you can use the BMS frequency code:

>>> pd.date_range(start=’1/1/2018′, periods=5, freq=’3MS’)
DatetimeIndex([‘2018-01-01’, ‘2018-04-01’, ‘2018-07-01’, ‘2018-10-01’,
‘2019-01-01′],
dtype=’datetime64[ns]’, freq=’3MS’)

Here’s what the above code is doing:
1. start=’1/1/2018′ – We’re telling Pandas to start the range at January 1st, 2018.
2. periods=5 – We’re telling Pandas to create 5 periods.
3. freq=’3MS’ – We’re telling Pandas to create periods at an interval of 3 months, starting at the beginning of the month.

The output is a DatetimeIndex with 5 periods.

Note that the first period starts at January 1st, 2018. This is because the first period is 3 months long, and the start of the first period is the first day of the first month.

You can also create a range of dates that ends at the end of the month by using the MS frequency code:

>>> pd.date_range(start=’1/1/2018′, periods=5, freq=’3MS’)
DatetimeIndex([‘2018-01-01’, ‘2018-04-01’, ‘2018-07-01’, ‘2018-10-01’,
‘2019-01-01′],
dtype=’datetime64[ns]’, freq=’3MS’)

Here’s what the above code is doing:
1. start=’1/1/2018′ – We’re telling Pandas to start the range at January 1st, 2018.
2. periods=5 – We’re telling Pandas to create 5 periods.
3. freq=’3MS’ – We’re telling Pandas to create periods at an interval of 3 months, ending at the end of the month.

The output is a DatetimeIndex with 5 periods.

Note that the first period starts at January 1st, 2018. This is because the first period is 3 months long, and the start of the first period is the first day of the first month.

You can also create a range of dates that ends at the end of the month by using the MS frequency code:

>>> pd.date_range(start=’1/1/2018′, periods=5, freq=’3MS’)
DatetimeIndex([‘2018-01-01’, ‘2018-04-01’, ‘2018-07-01’, ‘2018-10-01’,
‘2019-01-01′],
dtype=’datetime64[ns]’, freq=’3MS’)

Here’s what the above code is doing:
1. start=’1/1/2018′ – We’re telling Pandas to start the range at January 1st, 2018.
2. periods=5 – We’re telling Pandas to create 5 periods.
3. freq=’3MS’ – We’re telling Pandas to create periods at an interval of 3 months, ending at the end of the month.

The output is a DatetimeIndex with 5 periods.

Note that the first period starts at January 1st, 2018. This is because the first period is 3 months long, and the start of the first period is the first day of the first month.

You can also create a range of dates that ends at the end of the month by using the MS frequency code:

>>> pd.date_range(start=’1/1/2018′, periods=5, freq=’3MS’)
DatetimeIndex([‘2018-01-01’, ‘2018-04-01’, ‘2018-07-01’, ‘2018-10-01’,
‘2019-01-01’],
dtype