Skip to content

Commit d2c5596

Browse files
adminadmin
admin
authored and
admin
committed
raising FutureWarning instead of DeprecationWarning
1 parent ab8c473 commit d2c5596

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
@@ -264,7 +264,7 @@ Avoid iterating over ``Series.str``
264264
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
265265

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

@@ -280,7 +280,7 @@ Since no clear purpose of this feature could be derived, there will be
280280
In [3]: generator = (_ for _ in s.str)
281281
In [4]: next(generator)
282282
Out[4]:
283-
DeprecationWarning: Columnar iteration over characters will be deprecated in future releases.
283+
FutureWarning: Columnar iteration over characters will be deprecated in future releases.
284284
0 a
285285
1 a
286286
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
@@ -329,7 +329,7 @@ def test_iter(self):
329329
strs = "google", "wikimedia", "wikipedia", "wikitravel"
330330
ds = Series(strs)
331331

332-
with tm.assert_produces_warning(DeprecationWarning):
332+
with tm.assert_produces_warning(FutureWarning):
333333
for s in ds.str:
334334
# iter must yield a Series
335335
assert isinstance(s, Series)
@@ -352,7 +352,7 @@ def test_iter_empty(self):
352352

353353
i, s = 100, 1
354354

355-
with tm.assert_produces_warning(DeprecationWarning):
355+
with tm.assert_produces_warning(FutureWarning):
356356
for i, s in enumerate(ds.str):
357357
pass
358358

@@ -364,7 +364,7 @@ def test_iter_empty(self):
364364
def test_iter_single_element(self):
365365
ds = Series(["a"])
366366

367-
with tm.assert_produces_warning(DeprecationWarning):
367+
with tm.assert_produces_warning(FutureWarning):
368368
for i, s in enumerate(ds.str):
369369
pass
370370

@@ -376,7 +376,7 @@ def test_iter_object_try_string(self):
376376

377377
i, s = 100, "h"
378378

379-
with tm.assert_produces_warning(DeprecationWarning):
379+
with tm.assert_produces_warning(FutureWarning):
380380
for i, s in enumerate(ds.str):
381381
pass
382382

0 commit comments

Comments
 (0)