Skip to content

Commit 6763b22

Browse files
committed
use _range instead of _start etc.
1 parent a60d1bd commit 6763b22

File tree

6 files changed

+120
-147
lines changed

6 files changed

+120
-147
lines changed

pandas/core/dtypes/concat.py

+11-10
Original file line numberDiff line numberDiff line change
@@ -541,36 +541,37 @@ def _concat_rangeindex_same_dtype(indexes):
541541
"""
542542
from pandas import Int64Index, RangeIndex
543543

544-
start = step = next = None
544+
start = step = next_ = None
545545

546546
# Filter the empty indexes
547547
non_empty_indexes = [obj for obj in indexes if len(obj)]
548548

549549
for obj in non_empty_indexes:
550+
rng = obj._range # type: range
550551

551552
if start is None:
552553
# This is set by the first non-empty index
553-
start = obj._start
554-
if step is None and len(obj) > 1:
555-
step = obj._step
554+
start = rng.start
555+
if step is None and len(rng) > 1:
556+
step = rng.step
556557
elif step is None:
557558
# First non-empty index had only one element
558-
if obj._start == start:
559+
if rng.start == start:
559560
return _concat_index_same_dtype(indexes, klass=Int64Index)
560-
step = obj._start - start
561+
step = rng.start - start
561562

562-
non_consecutive = ((step != obj._step and len(obj) > 1) or
563-
(next is not None and obj._start != next))
563+
non_consecutive = ((step != rng.step and len(rng) > 1) or
564+
(next_ is not None and rng.start != next_))
564565
if non_consecutive:
565566
return _concat_index_same_dtype(indexes, klass=Int64Index)
566567

567568
if step is not None:
568-
next = obj[-1] + step
569+
next_ = rng[-1] + step
569570

570571
if non_empty_indexes:
571572
# Get the stop value from "next" or alternatively
572573
# from the last non-empty index
573-
stop = non_empty_indexes[-1]._stop if next is None else next
574+
stop = non_empty_indexes[-1].stop if next_ is None else next_
574575
return RangeIndex(start, stop, step)
575576

576577
# Here all "indexes" had 0 length, i.e. were empty.

pandas/core/frame.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2494,7 +2494,7 @@ def memory_usage(self, index=True, deep=False):
24942494
4 1 1.0 1.0+0.0j 1 True
24952495
24962496
>>> df.memory_usage()
2497-
Index 80
2497+
Index 192
24982498
int64 40000
24992499
float64 40000
25002500
complex128 80000

0 commit comments

Comments
 (0)