-  
-   Notifications  You must be signed in to change notification settings 
- Fork 19.2k
Closed
Labels
API DesignDeprecateFunctionality to remove in pandasFunctionality to remove in pandasIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselves
Milestone
Description
Prior to #24521 (i.e., for pandas 0.23 and earlier), pandas.Index.intersection would not sort values:
# pandas 0.23.3 In [21]: pd.Index(['c', 'b', 'a']).intersection(['b', 'a']) Out[21]: Index(['b', 'a'], dtype='object') Now it does:
In [28]: pd.Index(['c', 'b', 'a']).intersection(['b', 'a']) Out[28]: Index(['a', 'b'], dtype='object') This turned up in a failure in xarray's test suite (not a real bug): pydata/xarray#2717
It's fine to change this for consistency, but a deprecation cycle would probably make sense so users aren't surprised by the behavior of their code changing, e.g., we could default to sort=None and issue a FutureWarning for now.
Metadata
Metadata
Assignees
Labels
API DesignDeprecateFunctionality to remove in pandasFunctionality to remove in pandasIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselves