0

please see the link to answer , appreciated dataframe has 2 columns ID and Name

Name has array whats needed is to cross multiply column I Dto Name

and expected result shown in the image link provided

enter image description here

Akshay Sehgal
  • 18,741
  • 3
  • 21
  • 51
danPy
  • 9
  • 2
  • Does this answer your question? [How to unnest (explode) a column in a pandas DataFrame?](https://stackoverflow.com/questions/53218931/how-to-unnest-explode-a-column-in-a-pandas-dataframe) – Akshay Sehgal Feb 06 '21 at 20:31

1 Answers1

1

Lets use df.explode -

df = pd.DataFrame({'ID':['A','B','C'],'Name':[['A','B','C'],['C','D'],['A']]})
df.explode('Name')
  ID Name
0  A    A
0  A    B
0  A    C
1  B    C
1  B    D
2  C    A
Akshay Sehgal
  • 18,741
  • 3
  • 21
  • 51