Skip to content

BUG: reset_index with a multi-index PeriodIndex #7746

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
jreback opened this issue Jul 13, 2014 · 0 comments · Fixed by #7802
Closed

BUG: reset_index with a multi-index PeriodIndex #7746

jreback opened this issue Jul 13, 2014 · 0 comments · Fixed by #7802
Labels
Bug MultiIndex Period Period data type Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Milestone

Comments

@jreback
Copy link
Contributor

jreback commented Jul 13, 2014

http://stackoverflow.com/questions/24718730/is-there-any-way-to-keep-a-periodindex-as-a-series-of-periods-with-a-reset-index

related: #7791, #7792 (and I think this causes both)
duped by #7793

In [10]: df = DataFrame(np.arange(9).reshape(-1,1),index=pd.MultiIndex.from_product([period_range('20130101',periods=3,freq='M'),['a','b','c']],names=['month','feature']),columns=['value'])

In [11]: df
Out[11]: 
                 value
month   feature       
2013-01 a            0
        b            1
        c            2
2013-02 a            3
        b            4
        c            5
2013-03 a            6
        b            7
        c            8

In [12]: df.reset_index()
ValueError: Length of values does not match length of index
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug MultiIndex Period Period data type Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant