Skip to content

Inplace operation on PeriodIndex cast it to Int64Index #6527

Closed
@dhirschfeld

Description

@dhirschfeld
In [1]: dates = pd.period_range('01-Jan-2015', '01-Jan-2016', freq='M')
   ...: series = pd.TimeSeries(np.arange(dates.size), dates)
   ...: 

In [2]: series
Out[2]: 
2015-01     0
2015-02     1
2015-03     2
2015-04     3
2015-05     4
2015-06     5
2015-07     6
2015-08     7
2015-09     8
2015-10     9
2015-11    10
2015-12    11
2016-01    12
Freq: M, dtype: int32

In [3]: series.index += 1

In [4]: series
Out[4]: 
541     0
542     1
543     2
544     3
545     4
546     5
547     6
548     7
549     8
550     9
551    10
552    11
553    12
dtype: int32

In [5]: series.index
Out[5]: Int64Index([541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553], dtype='int64')

In [6]: pd.__version__
Out[6]: '0.13.1-339-g6c3755b'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions