Skip to content

ENH: Make Series.explode work for sets #35614

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dsaxton opened this issue Aug 7, 2020 · 0 comments · Fixed by #35637
Closed

ENH: Make Series.explode work for sets #35614

dsaxton opened this issue Aug 7, 2020 · 0 comments · Fixed by #35637
Labels
Enhancement Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Milestone

Comments

@dsaxton
Copy link
Member

dsaxton commented Aug 7, 2020

Currently Series.explode does nothing for sets but I think this would be just as useful as lists or tuples. It also allows for a way to easily enforce uniqueness at the row level before exploding.

I don't think this would be breaking, unless something is specifically relying on the operation not working.

import pandas as pd                                                                                                                                                                                  

ser = pd.Series([{1, 2}, {1, 2, 3}]) 
ser
# 0       {1, 2}
# 1    {1, 2, 3}
# dtype: object                                                                                                                                                               
ser.explode()                                                                                                                                                                                        
# 0       {1, 2}
# 1    {1, 2, 3}
# dtype: object

Desired output:

ser.explode()
# 0    1
# 0    2
# 1    1
# 1    2
# 1    3
# dtype: object
@dsaxton dsaxton added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Aug 7, 2020
@dsaxton dsaxton added Reshaping Concat, Merge/Join, Stack/Unstack, Explode and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Aug 8, 2020
@jreback jreback added this to the 1.2 milestone Sep 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants