`explode`-like function in DataFrames

If I have a DataFrame in which one of the columns has Vectors of one of more elements, how do I make each value to be a different row with the rest of the data copied? Ex.:

A          | B 
[1, 17, 9] | "abc"
[2, 5]     | "def"

becomes

A  | B 
1  | "abc"
17 | "abc"
9  | "abc"
2  | "def"
5  | "def"

Other languages/frameworks have this function by the name of explode. Every time I need to do some work I end up needing this function and I never remember how I solved the problem the last time. It is a major annoyance.

1 Like

This function should do what you’re looking for

flatten(df,:A)
4 Likes

Thanks! For some reason I am not able to associate the term flatten with this command in DataFrames, explode always come first to my mind.

there was some discussion about it some time ago

these days it seems like a more frequent verb