Is there any function in julia equivalent to pandas explode function

Hi Guys,
Say I have a dataset like this:

x = DataFrame(a=[1,3,4,5],b=["a;b;c;d","a;c;d","a;c","b;d"])

I want to first split the column b and then explode it to a long dataset.
In python the code is like this:

x['b'] = x['b'].str.split(";")
x.explode('b')

Is there any way I could do the same as in python?
Thanks guys!
PS: The first step to split the string could be, I am puzzled by the second part

 select(x,:b=>ByRow(v->split(v,';')))
1 Like

In your example, how should x look like after x.explode('b')?

It would expand the dataset horizontally, like would have
1 a
1 b
1 c
1 d
3 a
3 c
3 d
like this(sorry I am not familiar with markdown table syntax)

x[!,"b2"] = split.(x.b, ";")
flatten(x, "b2")

For more info, ?flatten.

3 Likes

Thanks, my man!

or just:

x.b2 = split.(x.b, ";")