0

I have a pandas dataframe in the below format

 Number    List_Ids
 1kh3kh    [123,456,789]
 safhak   [1234,15315,180]

I would need to explode the column "List_Ids" based on column "Number".

 Number    Id
 1kh3kh   123
 1kh3kh   456
 1kh3kh   789
 safhak   1234
 safhak   15315
 safhak   180

Wondering is there a pandas function that I could use to achieve this?

Any leads would be appreciated.

user3447653
  • 3,386
  • 9
  • 50
  • 83
  • [DataFrame.explode](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.explode.html) -> `df.explode('List_Ids')` or `df.explode('List_Ids', ignore_index=True)` of you don't want duplicated index. – Henry Ecker Aug 30 '21 at 19:53

0 Answers0