I am working with a few csv datasets in order to create a new synthesized output that tells the user what data types from certain surveys need to be archived. After some normalizing and merges, I'm left with two final data frames to merge:
df1
Cruise ID needs_ctd needs_adcp
0 1505 FALSE TRUE
1 1506 FALSE TRUE
df2
Cruise ID needs_wc WC Instrument
0 NF1505 TRUE EM710
1 NF1505 TRUE Reson7125
2 NF1506 TRUE EK60
Currently, I'm merging using: df_out = df1.merge(df2, how="left", on="Cruise ID")
Which gives the following result:
df_out
Cruise ID needs_ctd needs_adcp needs_wc WC Instrument
0 1505 FALSE TRUE TRUE EM710
1 1505 FALSE TRUE TRUE Reson7125
2 1506 FALSE TRUE TRUE EK60
The problem here is that it can create some confusion for the user who might get confused about why "needs_adcp" is being repeated on two lines. So I'd like to instead be able to move the second WC Instrument information to new columns for 1505.
What I'd like to see instead:
df_out
Cruise ID needs_ctd needs_adcp needs_wc WC Instrument needs_wc2 WC Instrument2
0 1505 FALSE TRUE TRUE EM710 TRUE Reson7125
1 1506 FALSE TRUE TRUE EK60
Thank you for your help!