Skip to content

Commit 47aed69

Browse files
ZanirPZanirP
ZanirP
authored and
ZanirP
committed
fixed string lengths
1 parent 4d7b2d2 commit 47aed69

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

pandas/core/generic.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -6456,12 +6456,16 @@ def astype(
64566456
else:
64576457
# else, only a single dtype is given
64586458

6459-
# GH 61074: Make dtype="category" imply "ordered" = False + add deprecation warning
6459+
# GH 61074: Make dtype="category" imply "ordered" = False
6460+
# and add a deprecation warning
64606461
if dtype == "category":
64616462
if isinstance(self.dtype, CategoricalDtype):
64626463
if self.dtype.ordered:
64636464
warnings.warn(
6464-
"The 'category' dtype is being set to ordered=False by default.",
6465+
(
6466+
"The 'category' dtype is being set to ordered=False "
6467+
" by default."
6468+
),
64656469
DeprecationWarning,
64666470
stacklevel=find_stack_level(),
64676471
)

pandas/tests/series/methods/test_astype.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -610,8 +610,12 @@ def test_astype_categoricaldtype(self):
610610
def test_astype_categorical_to_categorical(
611611
self, name, dtype_ordered, series_ordered
612612
):
613+
# GH 61074
613614
def check_deprecation_warning(series):
614-
"""Helper function to check DeprecationWarning for ordered = True conversions"""
615+
"""
616+
Helper function to check DeprecationWarning
617+
for ordered = True conversions
618+
"""
615619
msg = "The 'category' dtype is being set to ordered=False by default."
616620
with tm.assert_produces_warning(DeprecationWarning, match=msg):
617621
result = series.astype("category")

0 commit comments

Comments
 (0)