Skip to content

CLN: remove unnecessary validate_for_numeric_unary #27891

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 5 commits into from
Aug 14, 2019
Merged
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
11 changes: 0 additions & 11 deletions pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5341,16 +5341,6 @@ def _maybe_update_attributes(self, attrs):
"""
return attrs

def _validate_for_numeric_unaryop(self, op, opstr):
"""
Validate if we can perform a numeric unary operation.
"""
if not self._is_numeric_dtype:
raise TypeError(
"cannot evaluate a numeric op "
"{opstr} for type: {typ}".format(opstr=opstr, typ=type(self).__name__)
)

@classmethod
def _add_numeric_methods_binary(cls):
"""
Expand Down Expand Up @@ -5383,7 +5373,6 @@ def _add_numeric_methods_unary(cls):
def _make_evaluate_unary(op, opstr):
def _evaluate_numeric_unary(self):

self._validate_for_numeric_unaryop(op, opstr)
attrs = self._get_attributes_dict()
attrs = self._maybe_update_attributes(attrs)
return Index(op(self.values), **attrs)
Expand Down