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.