Skip to content
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

Feature suggestion: unnest function for pandas #23470

Closed
ghost opened this issue Nov 3, 2018 · 1 comment
Closed

Feature suggestion: unnest function for pandas #23470

ghost opened this issue Nov 3, 2018 · 1 comment
Labels
Duplicate Report Duplicate issue or pull request Reshaping Concat, Merge/Join, Stack/Unstack, Explode

Comments

@ghost
Copy link

ghost commented Nov 3, 2018

It would really helpful if there's a function for unnesting lists in columns into it's own row while repeating other rows on length of the unnest. I know there are ways to solving this but a function would be a good idea.

A small example to demonstrate the unnest function.

## Sample dataframe.
df = pd.DataFrame({'id': [1,2,3],
              'name': [['test','test1','test2'],'test3','test4']})
print (df)

    id                 name
0   1   [test, test1, test2]
1   2                  test3
2   3                  test4

To,

## An example
unnest(df, on = 'name') 

    id   name
0   1    test
1   1   test1
2   1   test2
3   2   test3
4   3   test4

@ghost ghost changed the title unnest function for pandas Feature request: unnest function for pandas Nov 3, 2018
@ghost ghost changed the title Feature request: unnest function for pandas unnest function for pandas Nov 3, 2018
@ghost ghost changed the title unnest function for pandas Feature suggestion: unnest function for pandas Nov 3, 2018
@jreback
Copy link
Contributor

jreback commented Nov 3, 2018

duplicate of #16538

this is typically called expode. I suppose would take an implemetation.

@jreback jreback closed this as completed Nov 3, 2018
@jreback jreback added Reshaping Concat, Merge/Join, Stack/Unstack, Explode Duplicate Report Duplicate issue or pull request labels Nov 3, 2018
@jreback jreback added this to the No action milestone Nov 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Report Duplicate issue or pull request Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

No branches or pull requests

1 participant