Skip to content

Commit 8a0750c

Browse files
committed
use _range instead of _start etc.
1 parent 0041935 commit 8a0750c

File tree

6 files changed

+126
-151
lines changed

6 files changed

+126
-151
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

+5-5
Original file line numberDiff line numberDiff line change
@@ -2282,7 +2282,7 @@ def info(self, verbose=None, buf=None, max_cols=None, memory_usage=None,
22822282
text_col 5 non-null object
22832283
float_col 5 non-null float64
22842284
dtypes: float64(1), int64(1), object(1)
2285-
memory usage: 200.0+ bytes
2285+
memory usage: 312.0+ bytes
22862286
22872287
Prints a summary of columns count and its dtypes but not per column
22882288
information:
@@ -2292,7 +2292,7 @@ def info(self, verbose=None, buf=None, max_cols=None, memory_usage=None,
22922292
RangeIndex: 5 entries, 0 to 4
22932293
Columns: 3 entries, int_col to float_col
22942294
dtypes: float64(1), int64(1), object(1)
2295-
memory usage: 200.0+ bytes
2295+
memory usage: 312.0+ bytes
22962296
22972297
Pipe output of DataFrame.info to buffer instead of sys.stdout, get
22982298
buffer content and writes to a text file:
@@ -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
@@ -2513,7 +2513,7 @@ def memory_usage(self, index=True, deep=False):
25132513
The memory footprint of `object` dtype columns is ignored by default:
25142514
25152515
>>> df.memory_usage(deep=True)
2516-
Index 80
2516+
Index 192
25172517
int64 40000
25182518
float64 40000
25192519
complex128 80000
@@ -2525,7 +2525,7 @@ def memory_usage(self, index=True, deep=False):
25252525
many repeated values.
25262526
25272527
>>> df['object'].astype('category').memory_usage(deep=True)
2528-
5168
2528+
5280
25292529
"""
25302530
result = Series([c.memory_usage(index=False, deep=deep)
25312531
for col, c in self.iteritems()], index=self.columns)

0 commit comments

Comments
 (0)