Skip to content

Commit 22eb63c

Browse files
committed
xref #10711, remove more iget warnings
1 parent ae30697 commit 22eb63c

File tree

4 files changed

+34
-22
lines changed

4 files changed

+34
-22
lines changed

doc/source/whatsnew/v0.17.0.txt

+14-14
Original file line numberDiff line numberDiff line change
@@ -436,22 +436,22 @@ Deprecations
436436
.. note:: These indexing function have been deprecated in the documentation since 0.11.0.
437437

438438
- For ``Series`` the following indexing functions are deprecated (:issue:`10177`).
439-
===================== ==============================================================
440-
Deprecated Function Replacement
441-
===================== ==============================================================
442-
``.irow(i)`` ``.iloc[i]`` or ``.iat[i]``
443-
``.iget(i)`` ``.iloc[i]`` or ``.iat[i]``
444-
``.iget_value(i)`` ``.iloc[i]`` or ``.iat[i]``
445-
===================== ==============================================================
439+
===================== =================================
440+
Deprecated Function Replacement
441+
===================== =================================
442+
``.irow(i)`` ``.iloc[i]`` or ``.iat[i]``
443+
``.iget(i)`` ``.iloc[i]``
444+
``.iget_value(i)`` ``.iloc[i]`` or ``.iat[i]``
445+
===================== =================================
446446

447447
- For ``DataFrame`` the following indexing functions are deprecated (:issue:`10177`).
448-
===================== ==============================================================
449-
Deprecated Function Replacement
450-
===================== ==============================================================
451-
``.irow(i)`` ``.iloc[i]``
452-
``.iget_value(i, j)`` ``.iloc[i, j]`` or ``.iat[i, j]``
453-
``.icol(j)`` ``.iloc[:, j]``
454-
===================== ==============================================================
448+
===================== =================================
449+
Deprecated Function Replacement
450+
===================== =================================
451+
``.irow(i)`` ``.iloc[i]``
452+
``.iget_value(i, j)`` ``.iloc[i, j]`` or ``.iat[i, j]``
453+
``.icol(j)`` ``.iloc[:, j]``
454+
===================== =================================
455455

456456
- ``Categorical.name`` was deprecated to make ``Categorical`` more ``numpy.ndarray`` like. Use ``Series(cat, name="whatever")`` instead (:issue:`10482`).
457457

pandas/core/series.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ def iget(self, i, axis=0):
794794
DEPRECATED. Use ``.iloc[i]`` or ``.iat[i]`` instead
795795
"""
796796

797-
warnings.warn("iget(i) is deprecated. Please use .iloc[i] or .iat[i]",
797+
warnings.warn("iget(i) is deprecated. Please use .iloc[i]",
798798
FutureWarning, stacklevel=2)
799799
return self._ixs(i)
800800

pandas/tests/test_frame.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1466,7 +1466,7 @@ def f():
14661466
self.assertTrue(result.values.all())
14671467
self.assertTrue((cp.iloc[0:1] == df.iloc[0:1]).values.all())
14681468

1469-
warnings.filterwarnings(action='ignore', category=FutureWarning)
1469+
warnings.filterwarnings(action='default', category=FutureWarning)
14701470

14711471
cp = df.copy()
14721472
cp.iloc[4:5] = 0
@@ -2220,7 +2220,6 @@ class TestDataFrame(tm.TestCase, CheckIndexing,
22202220

22212221
def setUp(self):
22222222
import warnings
2223-
warnings.filterwarnings(action='ignore', category=FutureWarning)
22242223

22252224
self.frame = _frame.copy()
22262225
self.frame2 = _frame2.copy()

pandas/tests/test_series.py

+18-5
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,6 @@ class TestSeries(tm.TestCase, CheckNameIntegration):
577577

578578
def setUp(self):
579579
import warnings
580-
warnings.filterwarnings(action='ignore', category=FutureWarning)
581580

582581
self.ts = _ts.copy()
583582
self.ts.name = 'ts'
@@ -1145,14 +1144,28 @@ def test_getitem_get(self):
11451144
self.assertIsNone(result)
11461145

11471146
def test_iget(self):
1147+
11481148
s = Series(np.random.randn(10), index=lrange(0, 20, 2))
1149+
1150+
# 10711, deprecated
1151+
with tm.assert_produces_warning(FutureWarning):
1152+
s.iget(1)
1153+
1154+
# 10711, deprecated
1155+
with tm.assert_produces_warning(FutureWarning):
1156+
s.irow(1)
1157+
1158+
# 10711, deprecated
1159+
with tm.assert_produces_warning(FutureWarning):
1160+
s.iget_value(1)
1161+
11491162
for i in range(len(s)):
1150-
result = s.iget(i)
1163+
result = s.iloc[i]
11511164
exp = s[s.index[i]]
11521165
assert_almost_equal(result, exp)
11531166

11541167
# pass a slice
1155-
result = s.iget(slice(1, 3))
1168+
result = s.iloc[slice(1, 3)]
11561169
expected = s.ix[2:4]
11571170
assert_series_equal(result, expected)
11581171

@@ -1161,13 +1174,13 @@ def test_iget(self):
11611174
self.assertTrue((s[1:3] == 0).all())
11621175

11631176
# list of integers
1164-
result = s.iget([0, 2, 3, 4, 5])
1177+
result = s.iloc[[0, 2, 3, 4, 5]]
11651178
expected = s.reindex(s.index[[0, 2, 3, 4, 5]])
11661179
assert_series_equal(result, expected)
11671180

11681181
def test_iget_nonunique(self):
11691182
s = Series([0, 1, 2], index=[0, 1, 0])
1170-
self.assertEqual(s.iget(2), 2)
1183+
self.assertEqual(s.iloc[2], 2)
11711184

11721185
def test_getitem_regression(self):
11731186
s = Series(lrange(5), index=lrange(5))

0 commit comments

Comments
 (0)