Skip to content

Commit 0977cb6

Browse files
committed
CLN: remove PerformanceWarning to core.common from io.common
1 parent b291dd6 commit 0977cb6

File tree

12 files changed

+24
-22
lines changed

12 files changed

+24
-22
lines changed

pandas/computation/align.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def _align_core(terms):
101101
'than an order of magnitude on term {1!r}, '
102102
'by more than {2:.4g}; performance may '
103103
'suffer'.format(axis, terms[i].name, ordm),
104-
category=pd.io.common.PerformanceWarning,
104+
category=pd.core.common.PerformanceWarning,
105105
stacklevel=6)
106106

107107
if transpose:

pandas/computation/tests/test_eval.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ def check_performance_warning_for_poor_alignment(self, engine, parser):
10021002
df = DataFrame(randn(1000, 10))
10031003
s = Series(randn(10000))
10041004
if engine == 'numexpr':
1005-
seen = pd.io.common.PerformanceWarning
1005+
seen = pd.core.common.PerformanceWarning
10061006
else:
10071007
seen = False
10081008

@@ -1024,7 +1024,7 @@ def check_performance_warning_for_poor_alignment(self, engine, parser):
10241024
is_python_engine = engine == 'python'
10251025

10261026
if not is_python_engine:
1027-
wrn = pd.io.common.PerformanceWarning
1027+
wrn = pd.core.common.PerformanceWarning
10281028
else:
10291029
wrn = False
10301030

pandas/core/common.py

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ class PandasError(Exception):
2828
pass
2929

3030

31+
class PerformanceWarning(Warning):
32+
pass
33+
34+
3135
class SettingWithCopyError(ValueError):
3236
pass
3337

pandas/core/ops.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
is_integer_dtype, is_categorical_dtype,
2525
is_object_dtype, is_timedelta64_dtype,
2626
is_datetime64_dtype, is_datetime64tz_dtype,
27-
is_bool_dtype)
28-
from pandas.io.common import PerformanceWarning
27+
is_bool_dtype, PerformanceWarning)
2928

3029
# -----------------------------------------------------------------------------
3130
# Functions that add arithmetic methods to objects, given arithmetic factory

pandas/indexes/multi.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
_values_from_object,
2323
is_iterator,
2424
_ensure_int64, is_bool_indexer,
25-
is_list_like, is_null_slice)
25+
is_list_like, is_null_slice,
26+
PerformanceWarning)
2627

2728
from pandas.core.config import get_option
28-
from pandas.io.common import PerformanceWarning
2929

3030
from pandas.indexes.base import (Index, _ensure_index, _ensure_frozen,
3131
_get_na_value, InvalidIndexError)
@@ -1095,7 +1095,7 @@ def drop(self, labels, level=None, errors='raise'):
10951095
' without a level parameter may impact '
10961096
'performance.',
10971097
PerformanceWarning,
1098-
stacklevel=2)
1098+
stacklevel=3)
10991099
loc = loc.nonzero()[0]
11001100
inds.extend(loc)
11011101
else:

pandas/io/common.py

-4
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ def urlopen(*args, **kwargs):
5555
_VALID_URLS.discard('')
5656

5757

58-
class PerformanceWarning(Warning):
59-
pass
60-
61-
6258
class DtypeWarning(Warning):
6359
pass
6460

pandas/io/pytables.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
from pandas.tseries.api import PeriodIndex, DatetimeIndex
2323
from pandas.tseries.tdi import TimedeltaIndex
2424
from pandas.core.base import StringMixin
25-
from pandas.core.common import adjoin, pprint_thing
25+
from pandas.core.common import (adjoin, pprint_thing, _asarray_tuplesafe,
26+
PerformanceWarning)
2627
from pandas.core.algorithms import match, unique
2728
from pandas.core.categorical import Categorical
28-
from pandas.core.common import _asarray_tuplesafe
2929
from pandas.core.internals import (BlockManager, make_block,
3030
_block2d_to_blocknd,
3131
_factor_indexer, _block_shape)
@@ -34,7 +34,6 @@
3434
from pandas.tools.merge import concat
3535
from pandas import compat
3636
from pandas.compat import u_safe as u, PY3, range, lrange, string_types, filter
37-
from pandas.io.common import PerformanceWarning
3837
from pandas.core.config import get_option
3938
from pandas.computation.pytables import Expr, maybe_expression
4039

pandas/tests/frame/test_axis_select_reindex.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
assert_frame_equal,
1717
assertRaisesRegexp)
1818

19+
from pandas.core.common import PerformanceWarning
1920
import pandas.util.testing as tm
2021

2122
from pandas.tests.frame.common import TestData
@@ -134,8 +135,12 @@ def test_drop_multiindex_not_lexsorted(self):
134135

135136
# compare the results
136137
tm.assert_frame_equal(lexsorted_df, not_lexsorted_df)
137-
tm.assert_frame_equal(lexsorted_df.drop('a', axis=1),
138-
not_lexsorted_df.drop('a', axis=1))
138+
139+
expected = lexsorted_df.drop('a', axis=1)
140+
with tm.assert_produces_warning(PerformanceWarning):
141+
result = not_lexsorted_df.drop('a', axis=1)
142+
143+
tm.assert_frame_equal(result, expected)
139144

140145
def test_reindex(self):
141146
newFrame = self.frame.reindex(self.ts1.index)

pandas/tests/indexes/test_multi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from pandas import (date_range, MultiIndex, Index, CategoricalIndex,
1010
compat)
11-
from pandas.io.common import PerformanceWarning
11+
from pandas.core.common import PerformanceWarning
1212
from pandas.indexes.base import InvalidIndexError
1313
from pandas.compat import range, lrange, u, PY3, long, lzip
1414

pandas/tests/test_indexing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
assert_frame_equal, assert_panel_equal,
2323
assert_attr_equal)
2424
from pandas import concat, lib
25-
from pandas.io.common import PerformanceWarning
25+
from pandas.core.common import PerformanceWarning
2626

2727
import pandas.util.testing as tm
2828
from pandas import date_range

pandas/tseries/index.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@
1010
is_object_dtype, is_datetime64_dtype,
1111
is_datetimetz, is_dtype_equal,
1212
ABCSeries, is_integer, is_float,
13-
DatetimeTZDtype)
13+
DatetimeTZDtype, PerformanceWarning)
1414

15-
from pandas.io.common import PerformanceWarning
1615
from pandas.core.index import Index, Int64Index, Float64Index
1716
import pandas.compat as compat
1817
from pandas.compat import u

pandas/tseries/tests/test_timeseries.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from pandas.compat import range, long, StringIO, lrange, lmap, zip, product
3131
from numpy.random import rand
3232
from pandas.util.testing import assert_frame_equal
33-
from pandas.io.common import PerformanceWarning
33+
from pandas.core.common import PerformanceWarning
3434
import pandas.compat as compat
3535
import pandas.core.common as com
3636
from pandas import concat

0 commit comments

Comments
 (0)