Dear all,
I have trade data for bilateral trade. I have two data sets, the export data (tradeflow_comtrade_o) and the import data (tradeflow_comtrade_d). I want to merge the two datasets to have one dataset with export and import data. Unfortunately, the merge command did not lead to the results needed. I tried the append command which brought me a bit closer. The result when appending the two data sets:
ID year iso3_o iso3_d tradeflow_comtrade_o tradeflow_comtrade_d
45454 2021 USA FRA 3.07e+07
53085 2021 USA FRA 5.17e+07
45338 2022 USA FRA 4.69e+07
53165 2022 USA FRA 5.91e+07
45093 2023 USA FRA 4.53e+07
53097 2023 USA FRA 5.89e+07
As you can see the same year is always in two rows with export data in one row and import data in the second row.
I now want to merge the two rows into one, so I have one row per year.
I would be grateful for any help.
Best
Christopher
I have trade data for bilateral trade. I have two data sets, the export data (tradeflow_comtrade_o) and the import data (tradeflow_comtrade_d). I want to merge the two datasets to have one dataset with export and import data. Unfortunately, the merge command did not lead to the results needed. I tried the append command which brought me a bit closer. The result when appending the two data sets:
ID year iso3_o iso3_d tradeflow_comtrade_o tradeflow_comtrade_d
45454 2021 USA FRA 3.07e+07
53085 2021 USA FRA 5.17e+07
45338 2022 USA FRA 4.69e+07
53165 2022 USA FRA 5.91e+07
45093 2023 USA FRA 4.53e+07
53097 2023 USA FRA 5.89e+07
As you can see the same year is always in two rows with export data in one row and import data in the second row.
I now want to merge the two rows into one, so I have one row per year.
I would be grateful for any help.
Best
Christopher
Comment