Closed
Description
Code Sample, a copy-pastable example if possible
In [40]: pd.__version__
Out[40]: '0.24.0.dev0+812.g5f051408f.dirty'
#Bug
In [41]: pd.date_range(start='2012-01-02', end='2011-01-02', freq='-1W')
Out[41]: DatetimeIndex([], dtype='datetime64[ns]', freq='-1W-SUN')
# Addition with a Timestamp works
In [42]: pd.Timestamp('2012-01-02') + pd.tseries.frequencies.to_offset('-1W')
Out[42]: Timestamp('2012-01-01 00:00:00')
# Tick-like frequencies work
In [43]: pd.date_range(start='2011-01-03', end='2011-01-02', freq='-12H')
Out[43]:
DatetimeIndex(['2011-01-03 00:00:00', '2011-01-02 12:00:00',
'2011-01-02 00:00:00'],
dtype='datetime64[ns]', freq='-12H')
Expected Output
In [45]: pd.date_range(end='2012-01-02', start='2011-01-02', freq='1W')[::-1]
Out[45]:
DatetimeIndex(['2012-01-01', '2011-12-25', '2011-12-18', '2011-12-11',
'2011-12-04', '2011-11-27', '2011-11-20', '2011-11-13',
'2011-11-06', '2011-10-30', '2011-10-23', '2011-10-16',
'2011-10-09', '2011-10-02', '2011-09-25', '2011-09-18',
'2011-09-11', '2011-09-04', '2011-08-28', '2011-08-21',
'2011-08-14', '2011-08-07', '2011-07-31', '2011-07-24',
'2011-07-17', '2011-07-10', '2011-07-03', '2011-06-26',
'2011-06-19', '2011-06-12', '2011-06-05', '2011-05-29',
'2011-05-22', '2011-05-15', '2011-05-08', '2011-05-01',
'2011-04-24', '2011-04-17', '2011-04-10', '2011-04-03',
'2011-03-27', '2011-03-20', '2011-03-13', '2011-03-06',
'2011-02-27', '2011-02-20', '2011-02-13', '2011-02-06',
'2011-01-30', '2011-01-23', '2011-01-16', '2011-01-09',
'2011-01-02'],
dtype='datetime64[ns]', freq='-1W-SUN')