@@ -58,7 +58,7 @@ Note how this is sorted with capital letters first. If we apply the `ser.str.low
58
58
59
59
.. ipython :: python
60
60
61
- s.sort_values(key = lambda x : x.str.lower() )
61
+ s.sort_values(key = lambda x : x.str.lower)
62
62
63
63
64
64
When applied to a `DataFrame `, they key is applied per-column to all columns or a subset if
@@ -68,13 +68,11 @@ When applied to a `DataFrame`, they key is applied per-column to all columns or
68
68
69
69
df = pd.DataFrame({' a' : [' C' , ' C' , ' a' , ' a' , ' B' , ' B' ],
70
70
' b' : [1 , 2 , 3 , 4 , 5 , 6 ]})
71
- df.sort_values(by = [' a' , ' b' ], key = lambda col : col.str.lower()
72
- if col.name == ' a' else - col)
71
+ df.sort_values(by = [' a' ], key = lambda col : col.str.lower())
73
72
74
73
75
- For :meth: `DataFrame.sort_index ` with `MultiIndex `, the key function is applied per level. For
76
- more details, see examples and documentation in :meth: `DataFrame.sort_values `, :meth: `Series.sort_values `,
77
- and :meth: `~DataFrame.sort_index `.
74
+ For more details, see examples and documentation in :meth: `DataFrame.sort_values `,
75
+ :meth: `Series.sort_values `, and :meth: `~DataFrame.sort_index `.
78
76
79
77
.. _whatsnew_110.timestamp_fold_support :
80
78
0 commit comments