@@ -280,9 +280,9 @@ meaning and certain operations are possible. If the categorical is unordered, ``
280280.. ipython :: python
281281
282282 s = pd.Series(pd.Categorical([" a" ," b" ," c" ," a" ], ordered = False ))
283- s.sort( )
283+ s.sort_values( inplace = True )
284284 s = pd.Series([" a" ," b" ," c" ," a" ]).astype(' category' , ordered = True )
285- s.sort( )
285+ s.sort_values( inplace = True )
286286 s
287287 s.min(), s.max()
288288
@@ -302,7 +302,7 @@ This is even true for strings and numeric data:
302302 s = pd.Series([1 ,2 ,3 ,1 ], dtype = " category" )
303303 s = s.cat.set_categories([2 ,3 ,1 ], ordered = True )
304304 s
305- s.sort( )
305+ s.sort_values( inplace = True )
306306 s
307307 s.min(), s.max()
308308
@@ -320,7 +320,7 @@ necessarily make the sort order the same as the categories order.
320320 s = pd.Series([1 ,2 ,3 ,1 ], dtype = " category" )
321321 s = s.cat.reorder_categories([2 ,3 ,1 ], ordered = True )
322322 s
323- s.sort( )
323+ s.sort_values( inplace = True )
324324 s
325325 s.min(), s.max()
326326
@@ -349,14 +349,14 @@ The ordering of the categorical is determined by the ``categories`` of that colu
349349
350350 dfs = pd.DataFrame({' A' : pd.Categorical(list (' bbeebbaa' ), categories = [' e' ,' a' ,' b' ], ordered = True ),
351351 ' B' : [1 ,2 ,1 ,2 ,2 ,1 ,2 ,1 ] })
352- dfs.sort( [' A' , ' B' ])
352+ dfs.sort_values( by = [' A' , ' B' ])
353353
354354 Reordering the ``categories `` changes a future sort.
355355
356356.. ipython :: python
357357
358358 dfs[' A' ] = dfs[' A' ].cat.reorder_categories([' a' ,' b' ,' e' ])
359- dfs.sort( [' A' ,' B' ])
359+ dfs.sort_values( by = [' A' ,' B' ])
360360
361361 Comparisons
362362-----------
0 commit comments