I have 2 dataframes
df1 #This one is in fact the mapping file (300 rows)
Sample_title Sample_geo_accession
EC2003090503AA GSM118720
EC2003090502AA GSM118721
EC2003090504AA GSM118722
df2 #(300 rows)
cmap_name concentration (M) perturbation_scan_id vehicle_scan_id3
metformin 0.00001 EC2003090503AA EC2003090502AA
metformin 0.00001 EC2003090504AA EC2003090502AA
metformin 0.0000001 EC2003090503AA EC2003090502AA
I want to read every line in df2
and replace the perturbation_scan_id
and vehicle_scan_id3
by the !Sample_geo_accession
in df1
.
The final output will be:
df3
cmap_name concentration_M perturbation_scan_id vehicle_scan_id3
metformin 0.00001 GSM118720 GSM118721
metformin 0.00001 GSM118722 GSM118721
metformin 0.0000001 GSM118720 GSM118721