Skip to content

DEPR: remove .ix from tests/indexing/multiindex/test_ix.py #27565

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

Merged
Merged
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
26 changes: 7 additions & 19 deletions pandas/tests/indexing/multiindex/test_ix.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from warnings import catch_warnings, simplefilter

import numpy as np
import pytest

Expand All @@ -9,9 +7,8 @@
from pandas.util import testing as tm


@pytest.mark.filterwarnings("ignore:\\n.ix:FutureWarning")
class TestMultiIndexIx:
def test_frame_setitem_ix(self, multiindex_dataframe_random_data):
class TestMultiIndex:
def test_frame_setitem_loc(self, multiindex_dataframe_random_data):
frame = multiindex_dataframe_random_data
frame.loc[("bar", "two"), "B"] = 5
assert frame.loc[("bar", "two"), "B"] == 5
Expand All @@ -22,16 +19,7 @@ def test_frame_setitem_ix(self, multiindex_dataframe_random_data):
df.loc[("bar", "two"), 1] = 7
assert df.loc[("bar", "two"), 1] == 7

with catch_warnings(record=True):
simplefilter("ignore", FutureWarning)
df = frame.copy()
df.columns = list(range(3))
df.ix[("bar", "two"), 1] = 7
assert df.loc[("bar", "two"), 1] == 7

def test_ix_general(self):

# ix general issues
def test_loc_general(self):

# GH 2817
data = {
Expand All @@ -55,7 +43,7 @@ def test_ix_general(self):
expected = DataFrame({"amount": [222, 333, 444]}, index=index)
tm.assert_frame_equal(res, expected)

def test_ix_multiindex_missing_label_raises(self):
def test_loc_multiindex_missing_label_raises(self):
# GH 21593
df = DataFrame(
np.random.randn(3, 3),
Expand All @@ -64,12 +52,12 @@ def test_ix_multiindex_missing_label_raises(self):
)

with pytest.raises(KeyError, match=r"^2$"):
df.ix[2]
df.loc[2]

def test_series_ix_getitem_fancy(
def test_series_loc_getitem_fancy(
self, multiindex_year_month_day_dataframe_random_data
):
s = multiindex_year_month_day_dataframe_random_data["A"]
expected = s.reindex(s.index[49:51])
result = s.ix[[(2000, 3, 10), (2000, 3, 13)]]
result = s.loc[[(2000, 3, 10), (2000, 3, 13)]]
tm.assert_series_equal(result, expected)