File tree 2 files changed +11
-3
lines changed
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -6456,12 +6456,16 @@ def astype(
6456
6456
else :
6457
6457
# else, only a single dtype is given
6458
6458
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
6460
6461
if dtype == "category" :
6461
6462
if isinstance (self .dtype , CategoricalDtype ):
6462
6463
if self .dtype .ordered :
6463
6464
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
+ ),
6465
6469
DeprecationWarning ,
6466
6470
stacklevel = find_stack_level (),
6467
6471
)
Original file line number Diff line number Diff line change @@ -610,8 +610,12 @@ def test_astype_categoricaldtype(self):
610
610
def test_astype_categorical_to_categorical (
611
611
self , name , dtype_ordered , series_ordered
612
612
):
613
+ # GH 61074
613
614
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
+ """
615
619
msg = "The 'category' dtype is being set to ordered=False by default."
616
620
with tm .assert_produces_warning (DeprecationWarning , match = msg ):
617
621
result = series .astype ("category" )
You can’t perform that action at this time.
0 commit comments