diff --git a/pandas/core/generic.py b/pandas/core/generic.py
index 9d98b534da37c..337df8627ef4c 100644
--- a/pandas/core/generic.py
+++ b/pandas/core/generic.py
@@ -11,6 +11,8 @@
import pandas as pd
from pandas._libs import properties, Timestamp, iNaT
+from pandas.errors import AbstractMethodError
+
from pandas.core.dtypes.common import (
ensure_int64,
ensure_object,
@@ -200,7 +202,7 @@ def _constructor(self):
"""Used when a manipulation result has the same dimensions as the
original.
"""
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
def __unicode__(self):
# unicode representation based upon iterating over self
@@ -221,7 +223,7 @@ def _constructor_sliced(self):
"""Used when a manipulation result has one lower dimension(s) as the
original, such as DataFrame single columns slicing.
"""
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
@property
def _constructor_expanddim(self):
@@ -2884,7 +2886,7 @@ def _iget_item_cache(self, item):
return lower
def _box_item_values(self, key, values):
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
def _maybe_cache_changed(self, item, value):
"""The object has called back to us saying maybe it has changed.
diff --git a/pandas/core/groupby/generic.py b/pandas/core/groupby/generic.py
index 451f1199ac8e6..b0477c7d3a8ad 100644
--- a/pandas/core/groupby/generic.py
+++ b/pandas/core/groupby/generic.py
@@ -18,6 +18,7 @@
import pandas.compat as compat
from pandas.compat import lzip, map
from pandas.compat.numpy import _np_version_under1p13
+from pandas.errors import AbstractMethodError
from pandas.util._decorators import Appender, Substitution
from pandas.core.dtypes.cast import maybe_downcast_to_dtype
@@ -240,7 +241,7 @@ def _aggregate_generic(self, func, *args, **kwargs):
return self._wrap_generic_output(result, obj)
def _wrap_aggregated_output(self, output, names=None):
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
def _aggregate_item_by_item(self, func, *args, **kwargs):
# only for axis==0
@@ -1659,4 +1660,4 @@ def _aggregate_item_by_item(self, func, *args, **kwargs):
raise ValueError("axis value must be greater than 0")
def _wrap_aggregated_output(self, output, names=None):
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py
index ea7507799fa9a..12327e1cf148e 100644
--- a/pandas/core/groupby/groupby.py
+++ b/pandas/core/groupby/groupby.py
@@ -20,6 +20,7 @@ class providing the base-class of operations.
import pandas.compat as compat
from pandas.compat import callable, range, set_function_name, zip
from pandas.compat.numpy import function as nv
+from pandas.errors import AbstractMethodError
from pandas.util._decorators import Appender, Substitution, cache_readonly
from pandas.util._validators import validate_kwargs
@@ -706,7 +707,7 @@ def _iterate_slices(self):
yield self._selection_name, self._selected_obj
def transform(self, func, *args, **kwargs):
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
def _cumcount_array(self, ascending=True):
"""
@@ -861,7 +862,7 @@ def _python_agg_general(self, func, *args, **kwargs):
return self._wrap_aggregated_output(output)
def _wrap_applied_output(self, *args, **kwargs):
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
def _concat_objects(self, keys, values, not_indexed_same=False):
from pandas.core.reshape.concat import concat
diff --git a/pandas/core/groupby/ops.py b/pandas/core/groupby/ops.py
index 390334a89cbfe..125bd9a5e855d 100644
--- a/pandas/core/groupby/ops.py
+++ b/pandas/core/groupby/ops.py
@@ -13,6 +13,7 @@
from pandas._libs import NaT, groupby as libgroupby, iNaT, lib, reduction
from pandas.compat import lzip, range, zip
+from pandas.errors import AbstractMethodError
from pandas.util._decorators import cache_readonly
from pandas.core.dtypes.common import (
@@ -841,7 +842,7 @@ def _chop(self, sdata, slice_obj):
return sdata.iloc[slice_obj]
def apply(self, f):
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
class SeriesSplitter(DataSplitter):
diff --git a/pandas/core/indexes/datetimelike.py b/pandas/core/indexes/datetimelike.py
index 1d9d3b1d3bd16..4547f47314bad 100644
--- a/pandas/core/indexes/datetimelike.py
+++ b/pandas/core/indexes/datetimelike.py
@@ -10,6 +10,7 @@
from pandas._libs.tslibs.timestamps import RoundTo, round_nsint64
import pandas.compat as compat
from pandas.compat.numpy import function as nv
+from pandas.errors import AbstractMethodError
from pandas.util._decorators import Appender, cache_readonly
from pandas.core.dtypes.common import (
@@ -21,7 +22,7 @@
from pandas.core.dtypes.generic import ABCIndex, ABCIndexClass, ABCSeries
from pandas.core.dtypes.missing import isna
-from pandas.core import algorithms, common as com, ops
+from pandas.core import algorithms, ops
from pandas.core.arrays import PeriodArray
from pandas.core.arrays.datetimelike import DatetimeLikeArrayMixin
import pandas.core.indexes.base as ibase
@@ -531,7 +532,7 @@ def argmax(self, axis=None, *args, **kwargs):
@property
def _formatter_func(self):
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
def _format_attrs(self):
"""
diff --git a/pandas/io/common.py b/pandas/io/common.py
index 155cf566b4c40..3a67238a66450 100644
--- a/pandas/io/common.py
+++ b/pandas/io/common.py
@@ -10,12 +10,11 @@
import pandas.compat as compat
from pandas.compat import BytesIO, StringIO, string_types, text_type
from pandas.errors import ( # noqa
- DtypeWarning, EmptyDataError, ParserError, ParserWarning)
+ AbstractMethodError, DtypeWarning, EmptyDataError, ParserError,
+ ParserWarning)
from pandas.core.dtypes.common import is_file_like, is_number
-import pandas.core.common as com
-
from pandas.io.formats.printing import pprint_thing
# gh-12665: Alias for now and remove later.
@@ -67,7 +66,7 @@ def __iter__(self):
return self
def __next__(self):
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
if not compat.PY3:
diff --git a/pandas/io/html.py b/pandas/io/html.py
index bcbb07c6dddfb..c967bdd29df1f 100644
--- a/pandas/io/html.py
+++ b/pandas/io/html.py
@@ -12,12 +12,11 @@
from pandas.compat import (
binary_type, iteritems, lmap, lrange, raise_with_traceback, string_types,
u)
-from pandas.errors import EmptyDataError
+from pandas.errors import AbstractMethodError, EmptyDataError
from pandas.core.dtypes.common import is_list_like
from pandas import Series
-import pandas.core.common as com
from pandas.io.common import _is_url, _validate_header_arg, urlopen
from pandas.io.formats.printing import pprint_thing
@@ -256,7 +255,7 @@ def _text_getter(self, obj):
text : str or unicode
The text from an individual DOM node.
"""
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
def _parse_td(self, obj):
"""Return the td elements from a row element.
@@ -271,7 +270,7 @@ def _parse_td(self, obj):
list of node-like
These are the elements of each row, i.e., the columns.
"""
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
def _parse_thead_tr(self, table):
"""
@@ -286,7 +285,7 @@ def _parse_thead_tr(self, table):
list of node-like
These are the
row elements of a table.
"""
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
def _parse_tbody_tr(self, table):
"""
@@ -305,7 +304,7 @@ def _parse_tbody_tr(self, table):
list of node-like
These are the
row elements of a table.
"""
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
def _parse_tfoot_tr(self, table):
"""
@@ -320,7 +319,7 @@ def _parse_tfoot_tr(self, table):
list of node-like
These are the
row elements of a table.
"""
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
def _parse_tables(self, doc, match, attrs):
"""
@@ -346,7 +345,7 @@ def _parse_tables(self, doc, match, attrs):
list of node-like
HTML elements to be parsed into raw data.
"""
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
def _equals_tag(self, obj, tag):
"""
@@ -365,7 +364,7 @@ def _equals_tag(self, obj, tag):
boolean
Whether `obj`'s tag name is `tag`
"""
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
def _build_doc(self):
"""
@@ -376,7 +375,7 @@ def _build_doc(self):
node-like
The DOM from which to parse the table element.
"""
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
def _parse_thead_tbody_tfoot(self, table_html):
"""
diff --git a/pandas/io/json/json.py b/pandas/io/json/json.py
index af7b390de213d..4453416a97f89 100644
--- a/pandas/io/json/json.py
+++ b/pandas/io/json/json.py
@@ -7,11 +7,11 @@
import pandas._libs.json as json
from pandas._libs.tslibs import iNaT
from pandas.compat import StringIO, long, to_str, u
+from pandas.errors import AbstractMethodError
from pandas.core.dtypes.common import is_period_dtype
from pandas import DataFrame, MultiIndex, Series, compat, isna, to_datetime
-import pandas.core.common as com
from pandas.core.reshape.concat import concat
from pandas.io.common import (
@@ -97,7 +97,7 @@ def __init__(self, obj, orient, date_format, double_precision,
self._format_axes()
def _format_axes(self):
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
def write(self):
return self._write(self.obj, self.orient, self.double_precision,
@@ -658,7 +658,7 @@ def _convert_axes(self):
setattr(self.obj, axis, new_axis)
def _try_convert_types(self):
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
def _try_convert_data(self, name, data, use_dtypes=True,
convert_dates=True):
@@ -771,7 +771,7 @@ def _try_convert_to_date(self, data):
return data, False
def _try_convert_dates(self):
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
class SeriesParser(Parser):
diff --git a/pandas/io/parquet.py b/pandas/io/parquet.py
index 3d72b1ec3a47f..aad59f9805a3b 100644
--- a/pandas/io/parquet.py
+++ b/pandas/io/parquet.py
@@ -4,9 +4,9 @@
from warnings import catch_warnings
from pandas.compat import string_types
+from pandas.errors import AbstractMethodError
from pandas import DataFrame, get_option
-import pandas.core.common as com
from pandas.io.common import get_filepath_or_buffer, is_s3_url
@@ -67,10 +67,10 @@ def validate_dataframe(df):
raise ValueError("Index level names must be strings")
def write(self, df, path, compression, **kwargs):
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
def read(self, path, columns=None, **kwargs):
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
class PyArrowImpl(BaseImpl):
diff --git a/pandas/io/parsers.py b/pandas/io/parsers.py
index 12914c10e0655..9fd35effe1b07 100755
--- a/pandas/io/parsers.py
+++ b/pandas/io/parsers.py
@@ -20,7 +20,8 @@
import pandas.compat as compat
from pandas.compat import (
PY3, StringIO, lrange, lzip, map, range, string_types, u, zip)
-from pandas.errors import EmptyDataError, ParserError, ParserWarning
+from pandas.errors import (
+ AbstractMethodError, EmptyDataError, ParserError, ParserWarning)
from pandas.util._decorators import Appender
from pandas.core.dtypes.cast import astype_nansafe
@@ -33,7 +34,6 @@
from pandas.core import algorithms
from pandas.core.arrays import Categorical
-import pandas.core.common as com
from pandas.core.frame import DataFrame
from pandas.core.index import (
Index, MultiIndex, RangeIndex, ensure_index_from_sequences)
@@ -1050,7 +1050,7 @@ def _make_engine(self, engine='c'):
self._engine = klass(self.f, **self.options)
def _failover_to_python(self):
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
def read(self, nrows=None):
nrows = _validate_integer('nrows', nrows)
diff --git a/pandas/plotting/_core.py b/pandas/plotting/_core.py
index 405c534e8528b..1c70ece434abb 100644
--- a/pandas/plotting/_core.py
+++ b/pandas/plotting/_core.py
@@ -12,6 +12,7 @@
from pandas.util._decorators import cache_readonly, Appender
from pandas.compat import range, lrange, map, zip, string_types
import pandas.compat as compat
+from pandas.errors import AbstractMethodError
import pandas.core.common as com
from pandas.core.base import PandasObject
@@ -373,7 +374,7 @@ def _compute_plot_data(self):
self.data = numeric_data
def _make_plot(self):
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
def _add_table(self):
if self.table is False:
diff --git a/pandas/tests/io/parser/test_parsers.py b/pandas/tests/io/parser/test_parsers.py
index 50d927176a7b4..21286e9b82323 100644
--- a/pandas/tests/io/parser/test_parsers.py
+++ b/pandas/tests/io/parser/test_parsers.py
@@ -6,9 +6,9 @@
from pandas._libs.tslib import Timestamp
from pandas.compat import StringIO
+from pandas.errors import AbstractMethodError
from pandas import DataFrame, read_csv, read_table
-import pandas.core.common as com
import pandas.util.testing as tm
from .c_parser_only import CParserTests
@@ -46,7 +46,7 @@ def read_table(self, *args, **kwargs):
raise NotImplementedError
def float_precision_choices(self):
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
@pytest.fixture(autouse=True)
def setup_method(self, datapath):
diff --git a/pandas/tests/test_resample.py b/pandas/tests/test_resample.py
index 756385f0cfb56..7e0342e8b987a 100644
--- a/pandas/tests/test_resample.py
+++ b/pandas/tests/test_resample.py
@@ -24,12 +24,11 @@
notna, Timestamp, Timedelta)
from pandas.compat import range, lrange, zip, OrderedDict
-from pandas.errors import UnsupportedFunctionCall
+from pandas.errors import AbstractMethodError, UnsupportedFunctionCall
import pandas.tseries.offsets as offsets
from pandas.tseries.offsets import Minute, BDay
from pandas.core.groupby.groupby import DataError
-import pandas.core.common as com
from pandas.core.indexes.datetimes import date_range
from pandas.core.indexes.period import period_range, PeriodIndex, Period
@@ -599,7 +598,7 @@ def index(self, _index_start, _index_end, _index_freq):
@pytest.fixture
def _series_name(self):
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
@pytest.fixture
def _static_values(self, index):
diff --git a/pandas/tseries/offsets.py b/pandas/tseries/offsets.py
index 25c419e485db1..067a7d4622ca2 100644
--- a/pandas/tseries/offsets.py
+++ b/pandas/tseries/offsets.py
@@ -9,7 +9,6 @@
from pandas.core.dtypes.generic import ABCPeriod
from pandas.core.tools.datetimes import to_datetime
-import pandas.core.common as com
# import after tools, dateutil check
from dateutil.easter import easter
@@ -29,6 +28,7 @@
roll_yearday,
shift_month,
BaseOffset)
+from pandas.errors import AbstractMethodError
__all__ = ['Day', 'BusinessDay', 'BDay', 'CustomBusinessDay', 'CDay',
@@ -1097,7 +1097,7 @@ def apply(self, other):
def _apply(self, n, other):
"""Handle specific apply logic for child classes"""
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
@apply_index_wraps
def apply_index(self, i):
@@ -1137,11 +1137,11 @@ def _get_roll(self, i, before_day_of_month, after_day_of_month):
The roll array is based on the fact that i gets rolled back to
the first day of the month.
"""
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
def _apply_index_days(self, i, roll):
"""Apply the correct day for each date in i"""
- raise com.AbstractMethodError(self)
+ raise AbstractMethodError(self)
class SemiMonthEnd(SemiMonthOffset):