Task: Transform-by-output-target-schema (source dataset: github-pipelines)

Your task is to create a data transformation pipeline in Python using pandas libraries.

Given Source Tables below, and a Target Schema provided by users that demonstrates how the desired output table should look like schematically, please write Python pandas code that can transform the Source Tables into an output table, that matches the schema/structure given by the Target Schema.  Please note that the data values in the Target Schema are intended to represent the format and layout of the output table, but may not exactly match the actual data generated from the Source Tables when the python code is run on the Source Tables.

Use operations such as merge, groupby, pivot, apply, or any appropriate python or pandas steps. Your code should save the resulting DataFrame to a CSV file named 'output.csv'. Ensure that the code is executable and can be run directly as is, in a Python environment with pandas installed.

Source Tables:


Table #1
Filename: source_0.csv
Sample Rows in Markdown:
| Country Name                                 | Country Code   | Indicator Name                           | Indicator Code   | 1960             | 1961             | 1962             | 1963             | 1964             | 1965             | 1966             | 1967             | 1968             | 1969             | 1970             | 1971             | 1972             | 1973             | 1974             | 1975             | 1976             | 1977             | 1978             | 1979             | 1980             | 1981             | 1982             | 1983             | 1984             | 1985             | 1986             | 1987             | 1988             | 1989             | 1990             | 1991             | 1992             | 1993             | 1994             | 1995             | 1996             | 1997             | 1998             | 1999             | 2000             | 2001             | 2002             | 2003             | 2004             | 2005             | 2006             | 2007             | 2008             | 2009             |        2010 | 2011              | 2012             | 2013             | 2014             | 2015             |
|:---------------------------------------------|:---------------|:-----------------------------------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|:-----------------|------------:|:------------------|:-----------------|:-----------------|:-----------------|:-----------------|
| Latin America & Caribbean                    | LCN            | GDP at market prices (constant 2010 US$) | NY.GDP.MKTP.KD   | 803492775873.73  | 855792516560.91  | 896332360603.19  | 918608440831.59  | 987179926351.33  | 1038345019636.03 | 1079987315360.1  | 1127446052644.87 | 1215718573711.55 | 1292608845512.47 | 1379445187762.22 | 1471137532260.83 | 1576329120935.16 | 1711801326651.32 | 1820987958568.73 | 1889059822966.05 | 2005147417794.85 | 2101919442461.44 | 2184154321386.97 | 2328780651995.4  | 2472821137035.86 | 2478330458346.96 | 2458532710887.2  | 2392232376950.36 | 2487688956245.23 | 2576849084249.63 | 2694543860775.02 | 2786948139597.17 | 2811915926072.34 | 2849488889898.49 | 2863308943317.15 | 2970144261326.46 | 3056858353671.76 | 3176854219523.04 | 3322465539752.78 | 3379511742275.24 | 3493595762867.2  | 3671461535826.69 | 3749327081167.21 | 3750171041692.96 | 3890245734886.18 | 3929826757578.77 | 3941515772815.7  | 4005528586604.86 | 4254863315937.74 | 4448018711859.55 | 4686198072832.65 | 4951043779487.34 | 5143422555736.13 | 5079715995191.5  | 5.37141e+12 | 5617852993488.28  | 5783815964922.36 | 5947359876834.43 | 6005712877419.32 | 5949253110743.19 |
| Least developed countries: UN classification | LDC            | GDP at market prices (constant 2010 US$) | NY.GDP.MKTP.KD   |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  | 231902869710.59  | 234976892317.06  | 243647990482.4   | 256002585699.96  | 263947913982.23  | 269608361594.57  | 270693327156.87  | 274391789886.05  | 274132349275.54  | 270546837698.85  | 275719597991.34  | 290632469638.96  | 307774809357.5   | 324334230129.24  | 338274198907.15  | 352186016340.38  | 366348951068.8   | 386472197704.43  | 398305292431.19  | 419899836177.49  | 447872259494.02  | 484875993201.5   | 524673924193.4   | 573881121152.14  | 616405655304.96  | 643868091980.84  | 6.78321e+11 | 703712767747.74   | 733216921317.4   | 773931630291.01  | 816427072781.96  | 852680108728.95  |
| Low income                                   | LIC            | GDP at market prices (constant 2010 US$) | NY.GDP.MKTP.KD   |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  | 123596122575.81  | 124650988050.14  | 126578655663.25  | 129689351855.76  | 134191757295.56  | 138372118363.24  | 143289894438.35  | 145516469948.75  | 146138388943.5   | 146526910536.92  | 141107774848.76  | 140803602032.49  | 143060087092.56  | 148590010896.56  | 157432500810.56  | 162843585627.14  | 167866854686.44  | 173162797926.54  | 176301638180.71  | 184204020516.56  | 188349788536.15  | 194136142150.86  | 204631534828.05  | 217242808395.76  | 228873853670.31  | 243750946262.29  | 256483839242.58  | 270963748763.51  | 2.89212e+11 | 306224526424.11   | 319094281579.07  | 337853612417.38  | 358219286655.45  | 375031695102.66  |
| Liechtenstein                                | LIE            | GDP at market prices (constant 2010 US$) | NY.GDP.MKTP.KD   |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  | 5.08234e+09 |                   |                  |                  |                  |                  |
| Sri Lanka                                    | LKA            | GDP at market prices (constant 2010 US$) | NY.GDP.MKTP.KD   |                  | 5924493033.62    | 6150691336.36    | 6305488774.1     | 6551808520.8     | 6718024859.26    | 7055524282.15    | 7509831214.04    | 7945483594.76    | 8558622235.09    | 8887840752.84    | 9003996423.28    | 8967036826.76    | 9599876388.25    | 9969071394.64    | 10579799952.23   | 10932647568.42   | 11490277125.88   | 12139918649.08   | 12917305250.54   | 13672454340.66   | 14451719262.01   | 15050236594.15   | 15774753624.7    | 16579131431.17   | 17407989583.82   | 18166202737.37   | 18479680674.3    | 18936624973.34   | 19372035058.74   | 20611844394.12   | 21559986606.75   | 22508624131.35   | 24061733433.57   | 25409170950.2    | 26806697009.22   | 27825342704.38   | 29607667121.86   | 30998760577.36   | 32331874829.85   | 34271798040.94   | 33742158886.29   | 35079926055.48   | 37163768055.4    | 39187357999.19   | 41633334150.86   | 44825899741.29   | 47872638202.97   | 50721102373.42   | 52516077578.72   | 5.67257e+10 | 61493395362.82    | 67116707719.92   | 69395796204.82   | 72781341623.58   | 76264645401.5    |
| Lower middle income                          | LMC            | GDP at market prices (constant 2010 US$) | NY.GDP.MKTP.KD   | 525762516667.12  | 544989806881.86  | 564392867681.16  | 592080758998.55  | 628319327881.36  | 638027873499.0   | 644513970526.53  | 657315438848.66  | 687892817047.77  | 742144893162.8   | 802215163223.06  | 841668628645.51  | 860506511351.18  | 904831720784.64  | 953488539186.43  | 995456509187.53  | 1052443419558.61 | 1123984702863.02 | 1172498702764.27 | 1192957588064.43 | 1258222444113.3  | 1292530753011.84 | 1327842208678.22 | 1384438344944.73 | 1424254696374.37 | 1480380341886.16 | 1527425737283.83 | 1568555255433.73 | 1666198816958.44 | 1758435266817.65 | 1832529392680.27 | 1861335848182.54 | 1909068387576.59 | 1955516156018.81 | 2013735916576.92 | 2109874242324.22 | 2232486100694.97 | 2319162536594.93 | 2331053458277.18 | 2437217356146.36 | 2543239266653.39 | 2652431438549.63 | 2754006660327.36 | 2928139416321.77 | 3173936873435.2  | 3383451291348.84 | 3633146863611.6  | 3895562896471.63 | 4080416700807.0  | 4284426432092.9  | 4.60154e+12 | 4849873628068.09  | 5098203082659.83 | 5382492748134.26 | 5682391878693.79 | 5993615561341.78 |
| Low & middle income                          | LMY            | GDP at market prices (constant 2010 US$) | NY.GDP.MKTP.KD   | 2054620647431.25 | 2093274785702.67 | 2182874344801.12 | 2302578939468.0  | 2473393228700.0  | 2604222573541.16 | 2726945110564.33 | 2828390963296.82 | 3016766807864.45 | 3242829597530.21 | 3515468100599.44 | 3735116787108.46 | 3982382576863.52 | 4287452008595.33 | 4546644471437.42 | 4754083555052.71 | 5092416866772.74 | 5312250247908.3  | 5509581878372.01 | 5720978842684.08 | 5978197400641.91 | 6098640585313.9  | 6265337030310.67 | 6343776311800.08 | 6632526847102.54 | 6957920380429.14 | 7223130304136.32 | 7542444479044.07 | 7842787608623.9  | 8096702906928.17 | 8279711169538.0  | 8353954606315.69 | 8390604470058.07 | 8614351693634.12 | 8813994547200.36 | 9152037770591.46 | 9586837271189.19 | 10043574520871.1 | 10229975266163.6 | 10581749299974.1 | 11190464394783.6 | 11603993120683.4 | 12121970123539.6 | 12769877032161.3 | 13795963846946.4 | 14767250351505.0 | 15959067366171.9 | 17333009519927.6 | 18322969434214.8 | 18782902860568.0 | 2.01885e+13 | 21389841895354.39 | 22476856222199.2 | 23580436917544.0 | 24604834350986.0 | 25483438593057.1 |
| Lesotho                                      | LSO            | GDP at market prices (constant 2010 US$) | NY.GDP.MKTP.KD   | 208563606.9      | 212452896.37     | 245025776.08     | 271035439.62     | 293398890.39     | 299719009.12     | 298503584.12     | 331076484.58     | 329861038.83     | 334965753.31     | 342258199.58     | 359760323.7      | 359031052.11     | 453832770.8      | 503664013.48     | 435601395.84     | 483731557.89     | 589228734.49     | 697157030.71     | 717332189.68     | 697642997.45     | 702489100.71     | 720450353.57     | 737078003.01     | 773554130.44     | 793342233.31     | 837006794.25     | 837018802.91     | 908639798.01     | 958402701.29     | 1012496725.37    | 1052031720.07    | 1128361019.66    | 1165942171.29    | 1228268697.24    | 1252804220.86    | 1318121378.4     | 1371973072.43    | 1395900136.91    | 1401512097.7     | 1473554577.85    | 1535874197.27    | 1544050824.69    | 1616484633.44    | 1653530871.14    | 1698250617.27    | 1771401813.4     | 1855250499.99    | 1961620803.13    | 2027490711.28    | 2.18748e+09 | 2276044148.4      | 2389701173.48    | 2496306485.34    | 2587149144.08    |                  |
| Late-demographic dividend                    | LTE            | GDP at market prices (constant 2010 US$) | NY.GDP.MKTP.KD   | 1027826175090.95 | 1023379622852.27 | 1057263300659.56 | 1095855613836.74 | 1168607651136.28 | 1242153452203.93 | 1322276972357.63 | 1357682058697.46 | 1450816171380.4  | 1594156296627.79 | 1753831314141.22 | 1901710110108.79 | 2059442390344.79 | 2260480426618.85 | 2406404816272.17 | 2522743450943.81 | 2702368240299.43 | 2873181310448.02 | 3029230521502.85 | 3255006936267.12 | 3525664007447.28 | 3519249062314.39 | 3582502128354.28 | 3603908268042.39 | 3865955897179.12 | 4148664721417.77 | 4397070976383.02 | 4657311874005.91 | 4866658275655.15 | 5079590059373.19 | 5097402095113.98 | 5117000377165.69 | 5077870205975.88 | 5242700219632.98 | 5417815598352.63 | 5690940440614.7  | 5941419864120.9  | 6237879076820.82 | 6368925825507.41 | 6628012206408.17 | 7071334760694.95 | 7410956460598.67 | 7816777614383.49 | 8314372182086.73 | 8953338775600.77 | 9596721718936.97 | 10433040517155.9 | 11433935872898.3 | 12180529524202.3 | 12490094899749.6 | 1.34404e+13 | 14329639738667.9  | 15091313294262.6 | 15859913824034.3 | 16567845863790.6 | 17123636815101.3 |
| Lithuania                                    | LTU            | GDP at market prices (constant 2010 US$) | NY.GDP.MKTP.KD   |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  |                  | 19321871754.09   | 20316940116.58   | 22001870429.25   | 23644788818.23   | 23376504901.96   | 24272214758.87   | 25855838632.75   | 27603887122.41   | 30512940646.52   | 32511563593.0    | 35023864732.37   | 37617887784.83   | 41788565845.25   | 42886801934.28   | 36533481054.58   | 3.71326e+10 | 39377194356.12    | 40887547827.23   | 42336907127.71   | 43620761128.76   | 44315977742.44   |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
| Country             | Energy Supply   | Energy Supply per Capita   |   % Renewable |
|:--------------------|:----------------|:---------------------------|--------------:|
| Afghanistan         | 321.0           | 10.0                       |         78.66 |
| Albania             | 102.0           | 35.0                       |        100    |
| Algeria             | 1959.0          | 51.0                       |          0.55 |
| American Samoa      |                 |                            |          0.64 |
| Andorra             | 9.0             | 121.0                      |         88.69 |
| Angola              | 642.0           | 27.0                       |         70.9  |
| Anguilla            | 2.0             | 136.0                      |          0    |
| Antigua and Barbuda | 8.0             | 84.0                       |          0    |
| Argentina           | 3378.0          | 79.0                       |         24.06 |
| Armenia             | 143.0           | 48.0                       |         28.23 |


Table #3
Filename: source_2.csv
Sample Rows in Markdown:
|   Rank | Country            |   Documents |   Citable documents |   Citations |   Self-citations |   Citations per document |   H index |
|-------:|:-------------------|------------:|--------------------:|------------:|-----------------:|-------------------------:|----------:|
|      1 | China              |      127050 |              126767 |      597237 |           411683 |                     4.7  |       138 |
|      2 | United States      |       96661 |               94747 |      792274 |           265436 |                     8.19 |       230 |
|      3 | Japan              |       30504 |               30287 |      223024 |            61554 |                     7.31 |       134 |
|      4 | United Kingdom     |       20944 |               20357 |      206091 |            37874 |                     9.84 |       139 |
|      5 | Russian Federation |       18534 |               18301 |       34266 |            12422 |                     1.85 |        57 |
|      6 | Canada             |       17899 |               17620 |      215003 |            40930 |                    12.01 |       149 |
|      7 | Germany            |       17027 |               16831 |      140566 |            27426 |                     8.26 |       126 |
|      8 | India              |       15005 |               14841 |      128763 |            37209 |                     8.58 |       115 |
|      9 | France             |       13153 |               12973 |      130632 |            28601 |                     9.93 |       114 |
|     10 | South Korea        |       11983 |               11923 |      114675 |            22595 |                     9.57 |       104 |


Target Schema:
|   Rank |   0 |
|-------:|----:|
|      6 |   1 |
|      7 |   1 |
|      8 |   1 |
|     15 |   1 |
|     27 |   1 |
|     29 |   1 |
|     33 |   1 |
|     35 |   1 |
|     39 |   1 |
|     40 |   1 |

Return only the final code in markdown codeblock format, without any additional text or explanation. 



target: target.csv
train: source_0.csv
source_1.csv
source_2.csv
test: test_0.csv
test_1.csv
test_2.csv