Q: Explode multiple list columns pairs to more rows in Pandas Given a dataset as follows:
   id          words           tags
0   1  ['Φ', '20mm']  ['xc', 'PER']
1   2  ['Φ', '80mm']    ['xc', 'm']
2   3        ['EVA']         ['nz']
3   4       ['Q345']         ['nz']

df in the format of list of dict:
[{'id': 1, 'words': ['Φ', '20mm'], 'tags': ['xc', 'PER']},
 {'id': 2, 'words': ['Φ', '80mm'], 'tags': ['xc', 'm']},
 {'id': 3, 'words': ['EVA'], 'tags': ['nz']},
 {'id': 4, 'words': ['Q345'], 'tags': ['nz']}]

The elements from words have correspondent Part-of-speech tagging (POS tagging) in tags column.
I hope to convert dataframe to the following format:
   id words tags
0   1     Φ   xc
1   1  20mm  PER
2   2     Φ   xc
3   2  80mm    m
4   3   EVA   nz
5   4  Q345   nz

How could I acheive that in Pandas? Thanks.

A: You can consider first exploding the dataframe with id and words and the dataframe with id and tags then you can concat them.
import pandas as pd

df = pd.DataFrame(
    {"id":[1,2,3,4],
     "words":[['Φ', '20mm'],['Φ', '80mm'], ['EVA'], ['Q345']],
     "tags": [['xc', 'PER'],  ['xc', 'm'], ['nz'], ['nz']]})

a = df[["id", "words"]].explode("words")
b = df[["id", "tags"]].explode("tags")
pd.concat([a, b], axis=1)

