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
When using .loc to index into a dataframe whose index is not sorted, a KeyError is raised that indicates the key does not exist. But sorting the index allows the same .loc command to pull a range of values from the dataframe.
Describe the solution you'd like
I'd like to see this extended to regular indices. So that when I try to index into an unsorted dataframe, the error is more informative in how to fix it.
API breaking implications
Since UnsortedIndexError is already implemented, and inherits from KeyError I don't see any breaking implications?
Describe alternatives you've considered
Seems that bringing the UnsortedIndexError to regular indices (as it is already raised for a Multi-Index) is the best idea?
Is your feature request related to a problem?
When using
.loc
to index into a dataframe whose index is not sorted, aKeyError
is raised that indicates the key does not exist. But sorting the index allows the same.loc
command to pull a range of values from the dataframe.Describe the solution you'd like
I'd like to see this extended to regular indices. So that when I try to index into an unsorted dataframe, the error is more informative in how to fix it.
API breaking implications
Since
UnsortedIndexError
is already implemented, and inherits fromKeyError
I don't see any breaking implications?Describe alternatives you've considered
Seems that bringing the
UnsortedIndexError
to regular indices (as it is already raised for a Multi-Index) is the best idea?Additional context
I tested this with 1.2.4
The text was updated successfully, but these errors were encountered: