Python Forum
validate the existing value and change the series - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: validate the existing value and change the series (/thread-37125.html)



validate the existing value and change the series - datahub - May-03-2022

Hello Everyone.

I am new to the Python and this Forum. I have the requirement to generate the new set of dataset

Source Dataset

ID SRC_VAL TGT_VAL
1 A [B,C]
2 D [E,F]
3 G [B,H]

Output dataset

ID SRC_VAL
B 1
C 1
E 2
F 2
B 3
H 3


The Desired output is
ID SRC_VAL
B [1,3]
C [1]
E [2]
H [3]
F [ 2]

Can anyone help me in getting the desired output.
Thanks in Advance