Skip to content

Commit f51235a

Browse files
committed
CLN: rename Block.ref_locs -> mgr_locs to reduce confusion
PERF: add BlockPlacement class to optimize range-like cases CLN: unify get_slice & take/reindex ops along axis0 TST: add slicing/taking/reindexing tests for BlockManagers CLN: remove unused code
1 parent fb1aed6 commit f51235a

File tree

14 files changed

+1587
-878
lines changed

14 files changed

+1587
-878
lines changed

pandas/computation/tests/test_eval.py

100755100644
File mode changed.

pandas/core/format.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1292,7 +1292,7 @@ def _save_chunk(self, start_i, end_i):
12921292
float_format=self.float_format,
12931293
date_format=self.date_format)
12941294

1295-
for col_loc, col in zip(b.ref_locs, d):
1295+
for col_loc, col in zip(b.mgr_locs, d):
12961296
# self.data is a preallocated list
12971297
self.data[col_loc] = col
12981298

pandas/core/frame.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ def to_panel(self):
10451045
for block in selfsorted._data.blocks:
10461046
newb = block2d_to_blocknd(
10471047
values=block.values.T,
1048-
placement=block.ref_locs, shape=shape,
1048+
placement=block.mgr_locs, shape=shape,
10491049
labels=[major_labels, minor_labels],
10501050
ref_items=selfsorted.columns)
10511051
new_blocks.append(newb)

pandas/core/generic.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1689,7 +1689,7 @@ def reindex_axis(self, labels, axis=0, method=None, level=None, copy=True,
16891689
labels, method, level, limit=limit, copy_if_needed=True)
16901690
return self._reindex_with_indexers(
16911691
{axis: [new_index, indexer]}, method=method, fill_value=fill_value,
1692-
limit=limit, copy=copy).__finalize__(self)
1692+
limit=limit, copy=copy)
16931693

16941694
def _reindex_with_indexers(self, reindexers, method=None,
16951695
fill_value=np.nan, limit=None, copy=False,
@@ -1712,7 +1712,8 @@ def _reindex_with_indexers(self, reindexers, method=None,
17121712
# TODO: speed up on homogeneous DataFrame objects
17131713
new_data = new_data.reindex_indexer(index, indexer, axis=baxis,
17141714
fill_value=fill_value,
1715-
allow_dups=allow_dups)
1715+
allow_dups=allow_dups,
1716+
copy=copy)
17161717

17171718
if copy and new_data is self._data:
17181719
new_data = new_data.copy()

pandas/core/groupby.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2243,7 +2243,7 @@ def _cython_agg_blocks(self, how, numeric_only=True):
22432243
# see if we can cast the block back to the original dtype
22442244
result = block._try_cast_result(result)
22452245

2246-
newb = make_block(result, placement=block.ref_locs)
2246+
newb = make_block(result, placement=block.mgr_locs)
22472247
new_blocks.append(newb)
22482248

22492249
if len(new_blocks) == 0:

0 commit comments

Comments
 (0)