-
-
Couldn't load subscription status.
- Fork 19.2k
Closed
Labels
API DesignReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, Explode
Milestone
Description
I see lots of code that goes like this
In [17]: df = pd.DataFrame({'A': [1, 2, 3]})
In [18]: df
Out[18]:
A
0 1
1 2
2 3
In [19]: df.sort_values('A', ascending=False)
Out[19]:
A
2 3
1 2
0 1
In [20]: df.sort_values('A', ascending=False).reset_index(drop=True)
Out[20]:
A
0 3
1 2
2 1
might be nice from an API / consistency perspective to add a ignore_index=False|True keyword to .sort_values(), and .drop_duplicates() that does the reset in-line; this would give consistency similar to a pd.concat([......], ignore_index=True) operation which users are very familiar
Metadata
Metadata
Assignees
Labels
API DesignReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, Explode