Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inplace operation on PeriodIndex cast it to Int64Index #6527

Closed
dhirschfeld opened this issue Mar 3, 2014 · 1 comment · Fixed by #7741
Closed

Inplace operation on PeriodIndex cast it to Int64Index #6527

dhirschfeld opened this issue Mar 3, 2014 · 1 comment · Fixed by #7741
Labels
Enhancement Period Period data type
Milestone

Comments

@dhirschfeld
Copy link
Contributor

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'
@jreback jreback added this to the 0.15.0 milestone Mar 3, 2014
@jreback
Copy link
Contributor

jreback commented Mar 3, 2014

related to #5202

Period ops not real well supported ATM.. feel free to do a PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Period Period data type
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants