Skip to content

Commit 69cf7bb

Browse files
[ArrayManager] Add SingleArrayManager to back a Series
1 parent 01770d1 commit 69cf7bb

File tree

12 files changed

+306
-42
lines changed

12 files changed

+306
-42
lines changed

.github/workflows/ci.yml

+3
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ jobs:
161161
pytest pandas/tests/resample/ --array-manager
162162
pytest pandas/tests/reshape/merge --array-manager
163163
164+
pytest pandas/tests/series/methods --array-manager
165+
pytest pandas/tests/series/test_* --array-manager
166+
164167
# indexing subset (temporary since other tests don't pass yet)
165168
pytest pandas/tests/frame/indexing/test_indexing.py::TestDataFrameIndexing::test_setitem_boolean --array-manager
166169
pytest pandas/tests/frame/indexing/test_where.py --array-manager

pandas/core/generic.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
from pandas.core.internals import (
139139
ArrayManager,
140140
BlockManager,
141+
SingleArrayManager,
141142
)
142143
from pandas.core.missing import find_valid_index
143144
from pandas.core.ops import align_method_FRAME
@@ -5562,7 +5563,7 @@ def _protect_consolidate(self, f):
55625563
Consolidate _mgr -- if the blocks have changed, then clear the
55635564
cache
55645565
"""
5565-
if isinstance(self._mgr, ArrayManager):
5566+
if isinstance(self._mgr, (ArrayManager, SingleArrayManager)):
55665567
return f()
55675568
blocks_before = len(self._mgr.blocks)
55685569
result = f()

pandas/core/indexing.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1575,7 +1575,11 @@ def _setitem_with_indexer(self, indexer, value, name="iloc"):
15751575

15761576
# if there is only one block/type, still have to take split path
15771577
# unless the block is one-dimensional or it can hold the value
1578-
if not take_split_path and self.obj._mgr.blocks and self.ndim > 1:
1578+
if (
1579+
not take_split_path
1580+
and getattr(self.obj._mgr, "blocks", False)
1581+
and self.ndim > 1
1582+
):
15791583
# in case of dict, keys are indices
15801584
val = list(value.values()) if isinstance(value, dict) else value
15811585
blk = self.obj._mgr.blocks[0]

pandas/core/internals/__init__.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
from pandas.core.internals.array_manager import ArrayManager
2-
from pandas.core.internals.base import DataManager
1+
from pandas.core.internals.array_manager import (
2+
ArrayManager,
3+
SingleArrayManager,
4+
)
5+
from pandas.core.internals.base import (
6+
DataManager,
7+
SingleManager,
8+
)
39
from pandas.core.internals.blocks import ( # io.pytables, io.packers
410
Block,
511
CategoricalBlock,
@@ -35,6 +41,8 @@
3541
"ArrayManager",
3642
"BlockManager",
3743
"SingleBlockManager",
44+
"SingleManager",
45+
"SingleArrayManager",
3846
"concatenate_managers",
3947
# those two are preserved here for downstream compatibility (GH-33892)
4048
"create_block_manager_from_arrays",

0 commit comments

Comments
 (0)