Skip to content

Commit 896080a

Browse files
add pd.options.mode.data_manager to switch
1 parent 591579b commit 896080a

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

pandas/core/config_init.py

+6
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,12 @@ def use_inf_as_na_cb(key):
482482
cf.register_option(
483483
"use_inf_as_null", False, use_inf_as_null_doc, cb=use_inf_as_na_cb
484484
)
485+
cf.register_option(
486+
"data_manager",
487+
"block",
488+
"internal manager type",
489+
validator=is_one_of_factory(["block", "array"]),
490+
)
485491

486492
cf.deprecate_option(
487493
"mode.use_inf_as_null", msg=use_inf_as_null_doc, rkey="mode.use_inf_as_na"

pandas/core/frame.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ def __init__(
448448
copy: bool = False,
449449
# TODO setting default to "array" for testing purposes (the actual default
450450
# needs to stay "block" initially of course for backwards compatibility)
451-
manager: str = "array",
451+
manager: Optional[str] = None,
452452
):
453453
if data is None:
454454
data = {}
@@ -567,11 +567,16 @@ def __init__(
567567
values, index, columns, dtype=values.dtype, copy=False
568568
)
569569

570+
if manager is None:
571+
manager = get_option("mode.data_manager")
572+
570573
if manager == "array" and not isinstance(mgr, ArrayManager):
571574
# TODO proper initialization
572575
df = DataFrame(mgr, manager="block")
573576
arrays = [arr.copy() for arr in df._iter_column_arrays()]
574577
mgr = ArrayManager(arrays, [mgr.axes[1], mgr.axes[0]])
578+
# TODO check for case of manager="block" but mgr is ArrayManager
579+
575580
NDFrame.__init__(self, mgr)
576581

577582
# ----------------------------------------------------------------------

0 commit comments

Comments
 (0)