Skip to content

CLN: remove deprecated classes 'NumericBlock' and 'ObjectBlock' #57815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions pandas/core/internals/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ def __getattr__(name: str):
return create_block_manager_from_blocks

if name in [
"NumericBlock",
"ObjectBlock",
"Block",
"ExtensionBlock",
"DatetimeTZBlock",
Expand All @@ -49,25 +47,17 @@ def __getattr__(name: str):
# on hard-coding stacklevel
stacklevel=2,
)
if name == "NumericBlock":
from pandas.core.internals.blocks import NumericBlock

return NumericBlock
elif name == "DatetimeTZBlock":
if name == "DatetimeTZBlock":
from pandas.core.internals.blocks import DatetimeTZBlock

return DatetimeTZBlock
elif name == "ExtensionBlock":
from pandas.core.internals.blocks import ExtensionBlock

return ExtensionBlock
elif name == "Block":
else:
from pandas.core.internals.blocks import Block

return Block
else:
from pandas.core.internals.blocks import ObjectBlock

return ObjectBlock

raise AttributeError(f"module 'pandas.core.internals' has no attribute '{name}'")
12 changes: 0 additions & 12 deletions pandas/core/internals/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2148,18 +2148,6 @@ def is_numeric(self) -> bool: # type: ignore[override]
return kind in "fciub"


class NumericBlock(NumpyBlock):
# this Block type is kept for backwards-compatibility
# TODO(3.0): delete and remove deprecation in __init__.py.
__slots__ = ()


class ObjectBlock(NumpyBlock):
# this Block type is kept for backwards-compatibility
# TODO(3.0): delete and remove deprecation in __init__.py.
__slots__ = ()


class NDArrayBackedExtensionBlock(EABackedBlock):
"""
Block backed by an NDArrayBackedExtensionArray
Expand Down
7 changes: 0 additions & 7 deletions pandas/tests/internals/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ def test_namespace():
@pytest.mark.parametrize(
"name",
[
"NumericBlock",
"ObjectBlock",
"Block",
"ExtensionBlock",
"DatetimeTZBlock",
Expand All @@ -53,11 +51,6 @@ def test_deprecations(name):
with tm.assert_produces_warning(DeprecationWarning, match=msg):
getattr(internals, name)

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


def test_make_block_2d_with_dti():
# GH#41168
Expand Down