Skip to content

WARN: fix some warnings #12320

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

Closed
wants to merge 1 commit into from
Closed
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
10 changes: 7 additions & 3 deletions pandas/tests/frame/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,13 @@ def test_getitem_boolean(self):
assert_frame_equal(subframe_obj, subframe)

# test that Series indexers reindex
indexer_obj = indexer_obj.reindex(self.tsframe.index[::-1])
subframe_obj = self.tsframe[indexer_obj]
assert_frame_equal(subframe_obj, subframe)
# we are producing a warning that since the passed boolean
# key is not the same as the given index, we will reindex
# not sure this is really necessary
with tm.assert_produces_warning(UserWarning):
indexer_obj = indexer_obj.reindex(self.tsframe.index[::-1])
subframe_obj = self.tsframe[indexer_obj]
assert_frame_equal(subframe_obj, subframe)

# test df[df > 0]
for df in [self.tsframe, self.mixed_frame,
Expand Down
8 changes: 8 additions & 0 deletions pandas/tests/series/test_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -1197,8 +1197,16 @@ def tester(a, b):
# TODO: Fix this exception - needs to be fixed! (see GH5035)
# (previously this was a TypeError because series returned
# NotImplemented

# this is an alignment issue; these are equivalent
# https://github.com/pydata/pandas/issues/5284

self.assertRaises(ValueError, lambda: d.__and__(s, axis='columns'))
self.assertRaises(ValueError, tester, s, d)

# this is wrong as its not a boolean result
# result = d.__and__(s,axis='index')

def test_operators_corner(self):
series = self.ts

Expand Down
14 changes: 10 additions & 4 deletions pandas/tests/test_graphics_others.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,18 +425,24 @@ def test_scatter_matrix_axis(self):
with tm.RNGContext(42):
df = DataFrame(randn(100, 3))

axes = _check_plot_works(scatter_matrix, filterwarnings='always',
frame=df, range_padding=.1)
# we are plotting multiples on a sub-plot
with tm.assert_produces_warning(UserWarning):
axes = _check_plot_works(scatter_matrix, filterwarnings='always',
frame=df, range_padding=.1)
axes0_labels = axes[0][0].yaxis.get_majorticklabels()

# GH 5662
expected = ['-2', '-1', '0', '1', '2']
self._check_text_labels(axes0_labels, expected)
self._check_ticks_props(
axes, xlabelsize=8, xrot=90, ylabelsize=8, yrot=0)

df[0] = ((df[0] - 2) / 3)
axes = _check_plot_works(scatter_matrix, filterwarnings='always',
frame=df, range_padding=.1)

# we are plotting multiples on a sub-plot
with tm.assert_produces_warning(UserWarning):
axes = _check_plot_works(scatter_matrix, filterwarnings='always',
frame=df, range_padding=.1)
axes0_labels = axes[0][0].yaxis.get_majorticklabels()
expected = ['-1.2', '-1.0', '-0.8', '-0.6', '-0.4', '-0.2', '0.0']
self._check_text_labels(axes0_labels, expected)
Expand Down