Skip to content

Commit 4b1cb26

Browse files
committed
Merge branch 'filter'
2 parents 574a9df + 22eb63c commit 4b1cb26

File tree

4 files changed

+34
-22
lines changed

4 files changed

+34
-22
lines changed

doc/source/whatsnew/v0.17.0.txt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -472,22 +472,22 @@ Deprecations
472472
.. note:: These indexing function have been deprecated in the documentation since 0.11.0.
473473

474474
- For ``Series`` the following indexing functions are deprecated (:issue:`10177`).
475-
===================== ==============================================================
476-
Deprecated Function Replacement
477-
===================== ==============================================================
478-
``.irow(i)`` ``.iloc[i]`` or ``.iat[i]``
479-
``.iget(i)`` ``.iloc[i]`` or ``.iat[i]``
480-
``.iget_value(i)`` ``.iloc[i]`` or ``.iat[i]``
481-
===================== ==============================================================
475+
===================== =================================
476+
Deprecated Function Replacement
477+
===================== =================================
478+
``.irow(i)`` ``.iloc[i]`` or ``.iat[i]``
479+
``.iget(i)`` ``.iloc[i]``
480+
``.iget_value(i)`` ``.iloc[i]`` or ``.iat[i]``
481+
===================== =================================
482482

483483
- For ``DataFrame`` the following indexing functions are deprecated (:issue:`10177`).
484-
===================== ==============================================================
485-
Deprecated Function Replacement
486-
===================== ==============================================================
487-
``.irow(i)`` ``.iloc[i]``
488-
``.iget_value(i, j)`` ``.iloc[i, j]`` or ``.iat[i, j]``
489-
``.icol(j)`` ``.iloc[:, j]``
490-
===================== ==============================================================
484+
===================== =================================
485+
Deprecated Function Replacement
486+
===================== =================================
487+
``.irow(i)`` ``.iloc[i]``
488+
``.iget_value(i, j)`` ``.iloc[i, j]`` or ``.iat[i, j]``
489+
``.icol(j)`` ``.iloc[:, j]``
490+
===================== =================================
491491

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

pandas/core/series.py

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 2 deletions
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

Lines changed: 18 additions & 5 deletions
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)