Skip to content

Commit d04f908

Browse files
authoredMar 12, 2024··
CLN: remove deprecated classes 'NumericBlock' and 'ObjectBlock' (#57815)
remove deprecated classes NumericBlock, ObjectBlock
1 parent fb418b2 commit d04f908

File tree

3 files changed

+2
-31
lines changed

3 files changed

+2
-31
lines changed
 

‎pandas/core/internals/__init__.py

+2-12
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ def __getattr__(name: str):
3535
return create_block_manager_from_blocks
3636

3737
if name in [
38-
"NumericBlock",
39-
"ObjectBlock",
4038
"Block",
4139
"ExtensionBlock",
4240
"DatetimeTZBlock",
@@ -49,25 +47,17 @@ def __getattr__(name: str):
4947
# on hard-coding stacklevel
5048
stacklevel=2,
5149
)
52-
if name == "NumericBlock":
53-
from pandas.core.internals.blocks import NumericBlock
54-
55-
return NumericBlock
56-
elif name == "DatetimeTZBlock":
50+
if name == "DatetimeTZBlock":
5751
from pandas.core.internals.blocks import DatetimeTZBlock
5852

5953
return DatetimeTZBlock
6054
elif name == "ExtensionBlock":
6155
from pandas.core.internals.blocks import ExtensionBlock
6256

6357
return ExtensionBlock
64-
elif name == "Block":
58+
else:
6559
from pandas.core.internals.blocks import Block
6660

6761
return Block
68-
else:
69-
from pandas.core.internals.blocks import ObjectBlock
70-
71-
return ObjectBlock
7262

7363
raise AttributeError(f"module 'pandas.core.internals' has no attribute '{name}'")

‎pandas/core/internals/blocks.py

-12
Original file line numberDiff line numberDiff line change
@@ -2148,18 +2148,6 @@ def is_numeric(self) -> bool: # type: ignore[override]
21482148
return kind in "fciub"
21492149

21502150

2151-
class NumericBlock(NumpyBlock):
2152-
# this Block type is kept for backwards-compatibility
2153-
# TODO(3.0): delete and remove deprecation in __init__.py.
2154-
__slots__ = ()
2155-
2156-
2157-
class ObjectBlock(NumpyBlock):
2158-
# this Block type is kept for backwards-compatibility
2159-
# TODO(3.0): delete and remove deprecation in __init__.py.
2160-
__slots__ = ()
2161-
2162-
21632151
class NDArrayBackedExtensionBlock(EABackedBlock):
21642152
"""
21652153
Block backed by an NDArrayBackedExtensionArray

‎pandas/tests/internals/test_api.py

-7
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ def test_namespace():
4040
@pytest.mark.parametrize(
4141
"name",
4242
[
43-
"NumericBlock",
44-
"ObjectBlock",
4543
"Block",
4644
"ExtensionBlock",
4745
"DatetimeTZBlock",
@@ -53,11 +51,6 @@ def test_deprecations(name):
5351
with tm.assert_produces_warning(DeprecationWarning, match=msg):
5452
getattr(internals, name)
5553

56-
if name not in ["NumericBlock", "ObjectBlock"]:
57-
# NumericBlock and ObjectBlock are not in the internals.api namespace
58-
with tm.assert_produces_warning(DeprecationWarning, match=msg):
59-
getattr(api, name)
60-
6154

6255
def test_make_block_2d_with_dti():
6356
# GH#41168

0 commit comments

Comments
 (0)
Please sign in to comment.