File tree 2 files changed +25
-4
lines changed
2 files changed +25
-4
lines changed Original file line number Diff line number Diff line change 16
16
from pandas .core .internals .managers import (
17
17
BlockManager ,
18
18
SingleBlockManager ,
19
- create_block_manager_from_blocks ,
20
19
)
21
20
22
21
__all__ = [
31
30
"SingleBlockManager" ,
32
31
"SingleArrayManager" ,
33
32
"concatenate_managers" ,
34
- # this is preserved here for downstream compatibility (GH-33892)
35
- "create_block_manager_from_blocks" ,
36
33
]
37
34
38
35
@@ -41,6 +38,18 @@ def __getattr__(name: str):
41
38
42
39
from pandas .util ._exceptions import find_stack_level
43
40
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
+
44
53
if name in ["NumericBlock" , "ObjectBlock" ]:
45
54
warnings .warn (
46
55
f"{ name } is deprecated and will be removed in a future version. "
Original file line number Diff line number Diff line change 4
4
"""
5
5
6
6
import pandas as pd
7
+ import pandas ._testing as tm
7
8
from pandas .core import internals
8
9
from pandas .core .internals import api
9
10
@@ -37,7 +38,6 @@ def test_namespace():
37
38
"SingleBlockManager" ,
38
39
"SingleArrayManager" ,
39
40
"concatenate_managers" ,
40
- "create_block_manager_from_blocks" ,
41
41
]
42
42
43
43
result = [x for x in dir (internals ) if not x .startswith ("__" )]
@@ -51,3 +51,15 @@ def test_make_block_2d_with_dti():
51
51
52
52
assert blk .shape == (1 , 3 )
53
53
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