I have following pandas dataframe:
id          term            code
2445 | 2716 abcd | efgh     2345
1287        hgtz            6567
I would like to explode id and term column. How can I explode multiple columns to keep the values across the columns id, term and code together.
The expected output is:
id          term            code
2445        abcd            2345
2716        efgh            2345
1287        hgtz            6567
I have tried so far is:
df.assign(id=df['id'].str.split(' | ')).explode('id')