Skip to content

RangeIndex as default index #9999

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
wants to merge 13 commits into from
Closed
Prev Previous commit
Next Next commit
fix: add RangeIndex to ABCIndexClass, use _default_index() in _get_na…
…mes_from_index()
  • Loading branch information
ARF committed Apr 30, 2015
commit 703fc4b346877612e0b0b059b0e290fd80773ed3
1 change: 1 addition & 0 deletions pandas/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def _check(cls, inst):
ABCCategoricalIndex = create_pandas_abc_type("ABCCategoricalIndex", "_typ", ("categoricalindex",))
ABCIndexClass = create_pandas_abc_type("ABCIndexClass", "_typ", ("index",
"int64index",
"rangeindex",
"float64index",
"multiindex",
"datetimeindex",
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -5043,11 +5043,11 @@ def convert(arr):


def _get_names_from_index(data):
index = lrange(len(data))
has_some_name = any([getattr(s, 'name', None) is not None for s in data])
if not has_some_name:
return index
return _default_index(len(data))

index = lrange(len(data))
count = 0
for i, s in enumerate(data):
n = getattr(s, 'name', None)
Expand Down