Add key to sorting functions · Issue #3942 · pandas-dev/pandas (original) (raw)
Many python functions (sorting, max/min) accept a key argument, perhaps they could in pandas too.
.
The terrible motivating example was this awful hack from this question.... for which maybe one could do
df.sort_index(key=lambda t: literal_eval(t[1:-1]))
This would still be an awful awful hack, but a slightly less awful one.