Skip to content

Commit 22a0025

Browse files
simonjayhawkinsjreback
authored andcommitted
DEPR: remove .ix from tests/indexing/multiindex/test_ix.py (#27565)
1 parent ee17169 commit 22a0025

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

pandas/tests/indexing/multiindex/test_ix.py

+7-19
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from warnings import catch_warnings, simplefilter
2-
31
import numpy as np
42
import pytest
53

@@ -9,9 +7,8 @@
97
from pandas.util import testing as tm
108

119

12-
@pytest.mark.filterwarnings("ignore:\\n.ix:FutureWarning")
13-
class TestMultiIndexIx:
14-
def test_frame_setitem_ix(self, multiindex_dataframe_random_data):
10+
class TestMultiIndex:
11+
def test_frame_setitem_loc(self, multiindex_dataframe_random_data):
1512
frame = multiindex_dataframe_random_data
1613
frame.loc[("bar", "two"), "B"] = 5
1714
assert frame.loc[("bar", "two"), "B"] == 5
@@ -22,16 +19,7 @@ def test_frame_setitem_ix(self, multiindex_dataframe_random_data):
2219
df.loc[("bar", "two"), 1] = 7
2320
assert df.loc[("bar", "two"), 1] == 7
2421

25-
with catch_warnings(record=True):
26-
simplefilter("ignore", FutureWarning)
27-
df = frame.copy()
28-
df.columns = list(range(3))
29-
df.ix[("bar", "two"), 1] = 7
30-
assert df.loc[("bar", "two"), 1] == 7
31-
32-
def test_ix_general(self):
33-
34-
# ix general issues
22+
def test_loc_general(self):
3523

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

58-
def test_ix_multiindex_missing_label_raises(self):
46+
def test_loc_multiindex_missing_label_raises(self):
5947
# GH 21593
6048
df = DataFrame(
6149
np.random.randn(3, 3),
@@ -64,12 +52,12 @@ def test_ix_multiindex_missing_label_raises(self):
6452
)
6553

6654
with pytest.raises(KeyError, match=r"^2$"):
67-
df.ix[2]
55+
df.loc[2]
6856

69-
def test_series_ix_getitem_fancy(
57+
def test_series_loc_getitem_fancy(
7058
self, multiindex_year_month_day_dataframe_random_data
7159
):
7260
s = multiindex_year_month_day_dataframe_random_data["A"]
7361
expected = s.reindex(s.index[49:51])
74-
result = s.ix[[(2000, 3, 10), (2000, 3, 13)]]
62+
result = s.loc[[(2000, 3, 10), (2000, 3, 13)]]
7563
tm.assert_series_equal(result, expected)

0 commit comments

Comments
 (0)