Skip to content

BUG: .reset_index() should create a RangeIndex #12071

Closed
@jreback

Description

@jreback
In [10]: df = DataFrame({'A' : range(5)})

In [11]: df
Out[11]: 
   A
0  0
1  1
2  2
3  3
4  4

In [12]: df.index
Out[12]: RangeIndex(start=0, stop=5, step=1)

In [13]: df.reset_index()
Out[13]: 
   index  A
0      0  0
1      1  1
2      2  2
3      3  3
4      4  4

In [14]: df.reset_index().index
Out[14]: Int64Index([0, 1, 2, 3, 4], dtype='int64')

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIndexingRelated to indexing on series/frames, not to indexes themselves

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions