Skip to content

Commit

Permalink
TST: remove some deprecation warnings (#17870)
Browse files Browse the repository at this point in the history
  • Loading branch information
jreback committed Oct 14, 2017
1 parent e001500 commit 8d16271
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 21 deletions.
5 changes: 4 additions & 1 deletion pandas/io/html.py
Expand Up @@ -759,7 +759,7 @@ def _parse(flavor, io, match, attrs, encoding, **kwargs):

def read_html(io, match='.+', flavor=None, header=None, index_col=None,
skiprows=None, attrs=None, parse_dates=False,
tupleize_cols=False, thousands=',', encoding=None,
tupleize_cols=None, thousands=',', encoding=None,
decimal='.', converters=None, na_values=None,
keep_default_na=True):
r"""Read HTML tables into a ``list`` of ``DataFrame`` objects.
Expand Down Expand Up @@ -828,6 +828,9 @@ def read_html(io, match='.+', flavor=None, header=None, index_col=None,
:class:`~pandas.MultiIndex`, otherwise return raw tuples. Defaults to
``False``.
.. deprecated:: 0.21.0
This argument will be removed and will always convert to MultiIndex
thousands : str, optional
Separator to use to parse thousands. Defaults to ``','``.
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/indexes/test_multi.py
Expand Up @@ -458,7 +458,7 @@ def test_set_value_keeps_names(self):
df = df.sort_index()
assert df.is_copy is None
assert df.index.names == ('Name', 'Number')
df = df.set_value(('grethe', '4'), 'one', 99.34)
df.at[('grethe', '4'), 'one'] = 99.34
assert df.is_copy is None
assert df.index.names == ('Name', 'Number')

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/plotting/test_frame.py
Expand Up @@ -2835,7 +2835,7 @@ def test_plain_axes(self):
Series(rand(10)).plot(ax=cax)

fig, ax = self.plt.subplots()
from mpl_toolkits.axes_grid.inset_locator import inset_axes
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
iax = inset_axes(ax, width="30%", height=1., loc=3)
Series(rand(10)).plot(ax=ax)
Series(rand(10)).plot(ax=iax)
Expand Down
1 change: 0 additions & 1 deletion pandas/tests/plotting/test_misc.py
Expand Up @@ -204,7 +204,6 @@ def test_parallel_coordinates(self):
def test_parallel_coordinates_with_sorted_labels(self):
""" For #15908 """
from pandas.plotting import parallel_coordinates

df = DataFrame({"feat": [i for i in range(30)],
"class": [2 for _ in range(10)] +
[3 for _ in range(10)] +
Expand Down
12 changes: 6 additions & 6 deletions pandas/tests/reshape/test_merge.py
Expand Up @@ -1546,6 +1546,7 @@ def test_dtype_on_categorical_dates(self):
result_inner = pd.merge(df, df2, how='inner', on=['date'])
assert_frame_equal(result_inner, expected_inner)

@pytest.mark.parametrize('ordered', [True, False])
@pytest.mark.parametrize('category_column,categories,expected_categories',
[([False, True, True, False], [True, False],
[True, False]),
Expand All @@ -1554,20 +1555,19 @@ def test_dtype_on_categorical_dates(self):
['True', 'False'], ['True', 'False'])])
def test_merging_with_bool_or_int_cateorical_column(self, category_column,
categories,
expected_categories):
expected_categories,
ordered):
# GH 17187
# merging with a boolean/int categorical column
df1 = pd.DataFrame({'id': [1, 2, 3, 4],
'cat': category_column})
df1['cat'] = df1['cat'].astype('category',
categories=categories, ordered=True)
df1['cat'] = df1['cat'].astype(CDT(categories, ordered=ordered))
df2 = pd.DataFrame({'id': [2, 4], 'num': [1, 9]})
result = df1.merge(df2)
expected = pd.DataFrame({'id': [2, 4], 'cat': expected_categories,
'num': [1, 9]})
expected['cat'] = expected['cat'].astype('category',
categories=categories,
ordered=True)
expected['cat'] = expected['cat'].astype(
CDT(categories, ordered=ordered))
assert_frame_equal(expected, result)


Expand Down
6 changes: 3 additions & 3 deletions pandas/tests/test_categorical.py
Expand Up @@ -3592,7 +3592,7 @@ def test_slicing_and_getting_ops(self):
tm.assert_frame_equal(res_fancy, exp_fancy)

# get_value
res_val = df.get_value("j", "cats")
res_val = df.at["j", "cats"]
assert res_val == exp_val

# i : int, slice, or sequence of integers
Expand Down Expand Up @@ -3956,12 +3956,12 @@ def f():

# set_value
df = orig.copy()
df.set_value("j", "cats", "b")
df.at["j", "cats"] = "b"
tm.assert_frame_equal(df, exp_single_cats_value)

def f():
df = orig.copy()
df.set_value("j", "cats", "c")
df.at["j", "cats"] = "c"

pytest.raises(ValueError, f)

Expand Down
12 changes: 6 additions & 6 deletions pandas/tests/test_panel.py
Expand Up @@ -1451,14 +1451,14 @@ def test_reindex_axis_style(self):
expected1 = Panel(panel.values).iloc[:, [0, 1]]
expected2 = Panel(panel.values).iloc[:, :, [0, 1]]

result = panel.reindex([0, 1], axis=0)
assert_panel_equal(result, expected0)
result = panel.reindex([0, 1], axis=0)
assert_panel_equal(result, expected0)

result = panel.reindex([0, 1], axis=1)
assert_panel_equal(result, expected1)
result = panel.reindex([0, 1], axis=1)
assert_panel_equal(result, expected1)

result = panel.reindex([0, 1], axis=2)
assert_panel_equal(result, expected2)
result = panel.reindex([0, 1], axis=2)
assert_panel_equal(result, expected2)

def test_reindex_multi(self):
with catch_warnings(record=True):
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/test_panel4d.py
Expand Up @@ -563,8 +563,8 @@ def test_get_value(self):
for item in self.panel4d.items:
for mjr in self.panel4d.major_axis[::2]:
for mnr in self.panel4d.minor_axis:
result = self.panel4d.get_value(
label, item, mjr, mnr)
result = self.panel4d.loc[
label, item, mjr, mnr]
expected = self.panel4d[label][item][mnr][mjr]
assert_almost_equal(result, expected)

Expand Down

0 comments on commit 8d16271

Please sign in to comment.