Skip to content

Commit e760956

Browse files
adminadmin
admin
authored and
admin
committed
raising FutureWarning instead of DeprecationWarning
1 parent 08c32ea commit e760956

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

doc/source/whatsnew/v1.0.0.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ Avoid iterating over ``Series.str``
360360
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
361361

362362
Iterating over the `.str` accessor of :class:`Series` will now raise a
363-
`DeprecationWarning` and be removed in future releases (:issue:`28277`).
363+
`FutureWarning` and be removed in future releases (:issue:`28277`).
364364
Since no clear purpose of this feature could be derived, there will be
365365
no replacement.
366366

@@ -376,7 +376,7 @@ Since no clear purpose of this feature could be derived, there will be
376376
In [3]: generator = (_ for _ in s.str)
377377
In [4]: next(generator)
378378
Out[4]:
379-
DeprecationWarning: Columnar iteration over characters will be deprecated in future releases.
379+
FutureWarning: Columnar iteration over characters will be deprecated in future releases.
380380
0 a
381381
1 a
382382
dtype: object

pandas/core/strings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2095,7 +2095,7 @@ def __getitem__(self, key):
20952095
def __iter__(self):
20962096
warnings.warn(
20972097
"Columnar iteration over characters will be deprecated in future releases.",
2098-
DeprecationWarning,
2098+
FutureWarning,
20992099
stacklevel=2,
21002100
)
21012101
i = 0

pandas/tests/test_strings.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def test_iter(self):
327327
strs = "google", "wikimedia", "wikipedia", "wikitravel"
328328
ds = Series(strs)
329329

330-
with tm.assert_produces_warning(DeprecationWarning):
330+
with tm.assert_produces_warning(FutureWarning):
331331
for s in ds.str:
332332
# iter must yield a Series
333333
assert isinstance(s, Series)
@@ -350,7 +350,7 @@ def test_iter_empty(self):
350350

351351
i, s = 100, 1
352352

353-
with tm.assert_produces_warning(DeprecationWarning):
353+
with tm.assert_produces_warning(FutureWarning):
354354
for i, s in enumerate(ds.str):
355355
pass
356356

@@ -362,7 +362,7 @@ def test_iter_empty(self):
362362
def test_iter_single_element(self):
363363
ds = Series(["a"])
364364

365-
with tm.assert_produces_warning(DeprecationWarning):
365+
with tm.assert_produces_warning(FutureWarning):
366366
for i, s in enumerate(ds.str):
367367
pass
368368

@@ -374,7 +374,7 @@ def test_iter_object_try_string(self):
374374

375375
i, s = 100, "h"
376376

377-
with tm.assert_produces_warning(DeprecationWarning):
377+
with tm.assert_produces_warning(FutureWarning):
378378
for i, s in enumerate(ds.str):
379379
pass
380380

0 commit comments

Comments
 (0)