0

I am trying to create a period range with a frequency of 25 hours. I noticed that this works fine:

p1 = pd.period_range('2016-01-01 10:10', freq = '25H', periods = 10)

In particular, it produces the expected result:

PeriodIndex(['2016-01-01 10:00', '2016-01-02 11:00', '2016-01-03 12:00',
             '2016-01-04 13:00', '2016-01-05 14:00', '2016-01-06 15:00',
             '2016-01-07 16:00', '2016-01-08 17:00', '2016-01-09 18:00',
             '2016-01-10 19:00'],
            dtype='int64', freq='25H')

However, I can't make this work as a variant of 1 day + 1 hour:

 pd.period_range('2016-01-01 10:10', freq = '1D1H', periods = 10)

This actually produces:

PeriodIndex(['1971-12-02 01:00', '1971-12-02 02:00', '1971-12-02 03:00',
             '1971-12-02 04:00', '1971-12-02 05:00', '1971-12-02 06:00',
             '1971-12-02 07:00', '1971-12-02 08:00', '1971-12-02 09:00',
             '1971-12-02 10:00'],
            dtype='int64', freq='25H')

It has the right frequency, but the wrong offset, starting at 1971 as though I had not passed a starting time. Why is this and what is the correct way to create this sort of combined frequency?

helloB
  • 3,472
  • 10
  • 40
  • 87
  • The latter looks like a bug so are you reporting a bug or is there something in the first code snippet that doesn't do what you want? – EdChum Jun 27 '16 at 12:45
  • @EdChum I suppose I'm asking whether I found a bug or whether I am misunderstanding something. – helloB Jun 27 '16 at 14:37
  • To me it's a bug, I suggest posting an issue on https://github.com/pydata/pandas/issues – EdChum Jun 27 '16 at 14:38

0 Answers0