Skip to content

Commit ae8b15c

Browse files
committed
AbstractMethodError implementation in core/common.py
1 parent bd16952 commit ae8b15c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pandas/core/common.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ class SettingWithCopyWarning(Warning):
3939
class AmbiguousIndexError(PandasError, KeyError):
4040
pass
4141

42+
class AbstractMethodError(NotImplementedError):
43+
def __init__(self,m):
44+
self.message = m
45+
def __str__(self):
46+
return "This method must be defined on the concrete class - "+self.message
4247

4348
_POSSIBLY_CAST_DTYPES = set([np.dtype(t).name
4449
for t in ['O', 'int8',
@@ -134,7 +139,7 @@ def _isnull_new(obj):
134139
return lib.checknull(obj)
135140
# hack (for now) because MI registers as ndarray
136141
elif isinstance(obj, pd.MultiIndex):
137-
raise NotImplementedError("isnull is not defined for MultiIndex")
142+
raise AbstractMethodError("isnull is not defined for MultiIndex")
138143
elif isinstance(obj, (ABCSeries, np.ndarray)):
139144
return _isnull_ndarraylike(obj)
140145
elif isinstance(obj, ABCGeneric):
@@ -160,7 +165,7 @@ def _isnull_old(obj):
160165
return lib.checknull_old(obj)
161166
# hack (for now) because MI registers as ndarray
162167
elif isinstance(obj, pd.MultiIndex):
163-
raise NotImplementedError("isnull is not defined for MultiIndex")
168+
raise AbstractMethodError("isnull is not defined for MultiIndex")
164169
elif isinstance(obj, (ABCSeries, np.ndarray)):
165170
return _isnull_ndarraylike_old(obj)
166171
elif isinstance(obj, ABCGeneric):

0 commit comments

Comments
 (0)