ENH: sort=bool keyword argument for index.difference
See original GitHub issueI often want to remove certain elements from an index while retaining the original ordering of the index. For this reason a sort keyword in the index.difference
method would be required:
In: index = pd.Index([0, 1, 2, 4, 3])
In: index.difference({1, 2})
Out: Int64Index([0, 3, 4], dtype='int64')
# It would be cool to have instead
In: index.difference({1, 2}, sort=False)
Out: Int64Index([0, 4, 3], dtype='int64')
I think that this usecase appears frequently and setting the default to sort=True
doesn’t affect existing code.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
sort_index() got an unexpected keyword argument 'by' - ...
Method sort_index sorts values by dataframe index. What you want to do is to sort values by some columns. In this case you...
Read more >Mesmerize Documentation
Mesmerize is a platform for the annotation and analysis of neuronal calcium imaging data. It encompasses the entire.
Read more >Page — PyMuPDF 1.21.1 documentation - Read the Docs
Class representing a document page. A page object is created by Document.load_page() or, equivalently, via indexing the document like doc[n] ...
Read more >PyMuPDF Documentation
So PyMuPDF cannot coexist with packages named “fitz” in the same Python ... Method Document.insert_pdf() copies pages between different PDF ...
Read more >The SMT-LIBv2 Language and Tools: A Tutorial
At the 2010 SMT workshop, 10 different provers competed to demonstrate capability and perfor- ... function with no arguments) named x of sort...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am interested in submitting a pull request. Can I?
If the
sort
option needed inunion
, how do we define the unsortedunion
order?idx1.join(idx2.difference(idx1))
?