@@ -239,7 +239,7 @@ It's also possible to pass in the categories in a specific order:
239
239
240
240
.. ipython :: python
241
241
242
- s = pd.Series(list (' babc' )).astype(' category ' , categories = list (' abcd' ))
242
+ s = pd.Series(list (' babc' )).astype(pd.CategoricalDtype( list (' abcd' ) ))
243
243
s
244
244
245
245
# categories
@@ -356,7 +356,7 @@ meaning and certain operations are possible. If the categorical is unordered, ``
356
356
357
357
s = pd.Series(pd.Categorical([" a" ," b" ," c" ," a" ], ordered = False ))
358
358
s.sort_values(inplace = True )
359
- s = pd.Series([" a" ," b" ," c" ," a" ]).astype(' category ' , ordered = True )
359
+ s = pd.Series([" a" ," b" ," c" ," a" ]).astype(pd.CategoricalDtype( ordered = True ) )
360
360
s.sort_values(inplace = True )
361
361
s
362
362
s.min(), s.max()
@@ -456,9 +456,9 @@ categories or a categorical with any list-like object, will raise a TypeError.
456
456
457
457
.. ipython :: python
458
458
459
- cat = pd.Series([1 ,2 ,3 ]).astype(" category " , categories = [3 ,2 , 1 ], ordered = True )
460
- cat_base = pd.Series([2 ,2 ,2 ]).astype(" category " , categories = [3 ,2 , 1 ], ordered = True )
461
- cat_base2 = pd.Series([2 ,2 ,2 ]).astype(" category " , ordered = True )
459
+ cat = pd.Series([1 ,2 ,3 ]).astype(pd.CategoricalDtype( [3 , 2 , 1 ], ordered = True ) )
460
+ cat_base = pd.Series([2 ,2 ,2 ]).astype(pd.CategoricalDtype( [3 , 2 , 1 ], ordered = True ) )
461
+ cat_base2 = pd.Series([2 ,2 ,2 ]).astype(pd.CategoricalDtype( ordered = True ) )
462
462
463
463
cat
464
464
cat_base
0 commit comments