File tree 4 files changed +35
-0
lines changed
4 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -650,3 +650,15 @@ def fill_missing_names(names: Sequence[Hashable | None]) -> list[Hashable]:
650
650
list of column names with the None values replaced.
651
651
"""
652
652
return [f"level_{ i } " if name is None else name for i , name in enumerate (names )]
653
+
654
+
655
+ def _depr_core () -> None :
656
+ warnings .warn (
657
+ "pandas.core is deprecated and has been renamed to "
658
+ "pandas._core. Accessing `_core` directly is discouraged as "
659
+ "members can change without warning. You should use a public module "
660
+ "instead that exports the attribute in question. If you still would "
661
+ "like to access an attribute from it, please use pandas._core." ,
662
+ DeprecationWarning ,
663
+ stacklevel = 3 ,
664
+ )
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ subdir('_libs')
26
26
27
27
subdirs_list = [
28
28
' _config' ,
29
+ ' _core' ,
29
30
' _testing' ,
30
31
' api' ,
31
32
' arrays' ,
Original file line number Diff line number Diff line change @@ -381,3 +381,23 @@ def test_pandas_array_alias():
381
381
res = pd .arrays .PandasArray
382
382
383
383
assert res is pd .arrays .NumpyExtensionArray
384
+
385
+
386
+ @pytest .mark .parametrize ("submodule_name" , ["groupby" ])
387
+ def test_depr_pandas_core_submodule (submodule_name ):
388
+ # GH#27522
389
+
390
+ submodule = getattr (pd ._core , submodule_name )
391
+ warning_msg = "pandas.core is deprecated"
392
+ for submodule_member_name in dir (submodule ):
393
+ if submodule_member_name .startswith ("__" ) and submodule_member_name .endswith (
394
+ "__"
395
+ ):
396
+ continue
397
+ submodule_member = getattr (submodule , submodule_member_name )
398
+ with tm .assert_produces_warning (DeprecationWarning , match = warning_msg ):
399
+ core_submodule = __import__ (
400
+ f"pandas.core.{ submodule_name } " , fromlist = [submodule_member_name ]
401
+ )
402
+ with tm .assert_produces_warning (DeprecationWarning , match = warning_msg ):
403
+ assert submodule_member is getattr (core_submodule , submodule_member_name )
Original file line number Diff line number Diff line change 55
55
"_iLocIndexer" ,
56
56
# TODO(3.0): GH#55043 - remove upon removal of ArrayManager
57
57
"_get_option" ,
58
+ # GH#27522
59
+ "_depr_core" ,
58
60
}
59
61
60
62
You can’t perform that action at this time.
0 commit comments