File tree Expand file tree Collapse file tree 2 files changed +25
-4
lines changed
Expand file tree Collapse file tree 2 files changed +25
-4
lines changed Original file line number Diff line number Diff line change 1616from pandas .core .internals .managers import (
1717 BlockManager ,
1818 SingleBlockManager ,
19- create_block_manager_from_blocks ,
2019)
2120
2221__all__ = [
3130 "SingleBlockManager" ,
3231 "SingleArrayManager" ,
3332 "concatenate_managers" ,
34- # this is preserved here for downstream compatibility (GH-33892)
35- "create_block_manager_from_blocks" ,
3633]
3734
3835
@@ -41,6 +38,18 @@ def __getattr__(name: str):
4138
4239 from pandas .util ._exceptions import find_stack_level
4340
41+ if name == "create_block_manager_from_blocks" :
42+ # GH#33892
43+ warnings .warn (
44+ f"{ name } is deprecated and will be removed in a future version. "
45+ "Use public APIs instead." ,
46+ DeprecationWarning ,
47+ stacklevel = find_stack_level (),
48+ )
49+ from pandas .core .internals .managers import create_block_manager_from_blocks
50+
51+ return create_block_manager_from_blocks
52+
4453 if name in ["NumericBlock" , "ObjectBlock" ]:
4554 warnings .warn (
4655 f"{ name } is deprecated and will be removed in a future version. "
Original file line number Diff line number Diff line change 44"""
55
66import pandas as pd
7+ import pandas ._testing as tm
78from pandas .core import internals
89from pandas .core .internals import api
910
@@ -37,7 +38,6 @@ def test_namespace():
3738 "SingleBlockManager" ,
3839 "SingleArrayManager" ,
3940 "concatenate_managers" ,
40- "create_block_manager_from_blocks" ,
4141 ]
4242
4343 result = [x for x in dir (internals ) if not x .startswith ("__" )]
@@ -51,3 +51,15 @@ def test_make_block_2d_with_dti():
5151
5252 assert blk .shape == (1 , 3 )
5353 assert blk .values .shape == (1 , 3 )
54+
55+
56+ def test_create_block_manager_from_blocks_deprecated ():
57+ # GH#33892
58+ # If they must, downstream packages should get this from internals.api,
59+ # not internals.
60+ msg = (
61+ "create_block_manager_from_blocks is deprecated and will be "
62+ "removed in a future version. Use public APIs instead"
63+ )
64+ with tm .assert_produces_warning (DeprecationWarning , match = msg ):
65+ internals .create_block_manager_from_blocks
You can’t perform that action at this time.
0 commit comments