Skip to content

BUG: Resample loses PeriodIndex name #12769

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

Closed
max-sixty opened this issue Apr 1, 2016 · 1 comment
Closed

BUG: Resample loses PeriodIndex name #12769

max-sixty opened this issue Apr 1, 2016 · 1 comment
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves Period Period data type Resample resample method
Milestone

Comments

@max-sixty
Copy link
Contributor

Code Sample, a copy-pastable example if possible

In [17]: series=pd.Series(range(10), pd.period_range(start='2000', periods=10, name='date', freq='M'))

In [18]: series
Out[18]: 
date
2000-01    0
2000-02    1
2000-03    2
2000-04    3
2000-05    4
2000-06    5
2000-07    6
2000-08    7
2000-09    8
2000-10    9
Freq: M, dtype: int64

In [19]: series.index
Out[19]: 
PeriodIndex(['2000-01', '2000-02', '2000-03', '2000-04', '2000-05', '2000-06',
             '2000-07', '2000-08', '2000-09', '2000-10'],
            dtype='int64', name='date', freq='M')
# Note name='date'

In [20]: series.resample('D').pad().index
Out[20]: 
PeriodIndex(['2000-01-01', '2000-01-02', '2000-01-03', '2000-01-04',
             '2000-01-05', '2000-01-06', '2000-01-07', '2000-01-08',
             '2000-01-09', '2000-01-10',
             ...
             '2000-10-22', '2000-10-23', '2000-10-24', '2000-10-25',
             '2000-10-26', '2000-10-27', '2000-10-28', '2000-10-29',
             '2000-10-30', '2000-10-31'],
            dtype='int64', length=305, freq='D')

# now no name

Expected Output

Out[20]: 
PeriodIndex(['2000-01-01', '2000-01-02', '2000-01-03', '2000-01-04',
             '2000-01-05', '2000-01-06', '2000-01-07', '2000-01-08',
             '2000-01-09', '2000-01-10',
             ...
             '2000-10-22', '2000-10-23', '2000-10-24', '2000-10-25',
             '2000-10-26', '2000-10-27', '2000-10-28', '2000-10-29',
             '2000-10-30', '2000-10-31'],
            dtype='int64', length=305, freq='D', name='date')

output of pd.show_versions()

Out[21]: '0.18.0'

@max-sixty max-sixty changed the title Resample loses PeriodIndex name BUG: Resample loses PeriodIndex name Apr 1, 2016
@jreback
Copy link
Contributor

jreback commented Apr 1, 2016

all these types of things are already fixed in #12743 . So will note this. actually. I take that back. something not getting propogated.

@jreback jreback added Bug Indexing Related to indexing on series/frames, not to indexes themselves Period Period data type labels Apr 1, 2016
@jreback jreback added this to the 0.18.1 milestone Apr 1, 2016
@jreback jreback closed this as completed in 05b2189 Apr 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves Period Period data type Resample resample method
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants