I have dataframe like below
Input
Date Country Type Zip_Incl Zip_Excl
10/4/2020 FR Regional 57_67_68
2/1/2020 GB Regional AB_DD
17/3/2021 GB Regional BT_TY TS_TN
18/3/2021 GB Regional
19/1/2021 IN Regional 68
I need to transform the input based on below conditions:
1)If Zip_incl is not empty then value to Zip_incl should be passed into Zip_Final
2)IF Zip_incl and Zip_Excl values are present then value of Zip_incl should be passed into Zip_Final
3)If Zip incl is empty and value is present for Zip_Excl is present then Zip_Excl should be passed to Zip_Final
Output
Date Country Type Zip_Incl Zip_Excl Zip_Final
10/4/2020 FR Regional 57 57
10/4/2020 FR Regional 67 67
10/4/2020 FR Regional 68 68
2/1/2020 GB Regional AB AB
2/1/2020 GB Regional DD DD
17/3/2021 GB Regional BT TS BT
17/3/2021 GB Regional TY TN TY
18/3/2021 GB Regional
19/1/2021 IN Regional 68 68
How can this be done?