You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I occasionally find myself wanting to sort not by the values of a Series but instead by some function of those values, so it could be quite handy to have a way of passing a callable to sort_values (perhaps just a by argument as in DataFrame.sort_values) with the idea being to sort by the return values. The same would likely be useful for DataFrame.sort_values.
A simple situation where you might want to do this would be if you want to sort by the magnitudes of the values in a Series without losing information about the sign. Another might be if the values themselves were collections, and you'd like to sort by their size, or by specific values within those collections.
Has interest in a feature like this been expressed before?
The text was updated successfully, but these errors were encountered:
I occasionally find myself wanting to sort not by the values of a
Series
but instead by some function of those values, so it could be quite handy to have a way of passing a callable tosort_values
(perhaps just aby
argument as inDataFrame.sort_values
) with the idea being to sort by the return values. The same would likely be useful forDataFrame.sort_values
.A simple situation where you might want to do this would be if you want to sort by the magnitudes of the values in a
Series
without losing information about the sign. Another might be if the values themselves were collections, and you'd like to sort by their size, or by specific values within those collections.Has interest in a feature like this been expressed before?
The text was updated successfully, but these errors were encountered: