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 |    2016 |    2017 |
|:---------------------------------------------|:---------------|:-----------------------------------------|:-----------------|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|--------:|
| Latin America & Caribbean                    | LCN            | Rural population (% of total population) | SP.RUR.TOTL.ZS   | 50.7227 | 49.9335 | 49.1334 | 48.3305 | 47.5227 | 46.7622 | 46.0025 | 45.2442 | 44.4851 | 43.7296 | 42.9787 | 42.2208 | 41.4694 | 40.7419 | 40.0231 | 39.305  | 38.5908 | 37.8778 | 37.1678 | 36.4646 | 35.7624 | 35.0762 | 34.419  | 33.7797 | 33.1469 | 32.5202 | 31.9071 | 31.3054 | 30.7119 | 30.1304 | 29.5649 | 29.0333 | 28.5243 | 28.0272 | 27.5346 | 27.0508 | 26.5892 | 26.1184 | 25.6511 | 25.201  | 24.7545 | 24.398  | 24.0656 | 23.7406 | 23.4176 | 23.0999 | 22.7863 | 22.4771 | 22.1717 | 21.8715 | 21.5748 | 21.2827 | 20.9973 | 20.7184 | 20.4457 | 20.1796 | 19.9196 | 19.6654 |
| Least developed countries: UN classification | LDC            | Rural population (% of total population) | SP.RUR.TOTL.ZS   | 90.4118 | 90.1662 | 89.8987 | 89.6169 | 89.3206 | 89.0138 | 88.6971 | 88.3468 | 87.9823 | 87.601  | 87.2189 | 86.8013 | 86.3595 | 85.9123 | 85.4582 | 85.5526 | 85.0706 | 84.5672 | 84.0457 | 83.5427 | 82.9801 | 82.4913 | 82.1607 | 81.8056 | 81.4206 | 81.0128 | 80.6018 | 80.187  | 79.764  | 79.3454 | 78.9119 | 78.5071 | 78.127  | 77.7583 | 77.4389 | 77.1264 | 76.8151 | 76.4943 | 76.18   | 75.8648 | 75.5421 | 75.1676 | 74.7613 | 74.3343 | 73.8966 | 73.4446 | 72.9852 | 72.5174 | 72.0254 | 71.5271 | 71.0223 | 70.5121 | 69.9979 | 69.481  | 68.9606 | 68.4372 | 67.9109 | 67.3823 |
| Low income                                   | LIC            | Rural population (% of total population) | SP.RUR.TOTL.ZS   | 87.3378 | 87.0158 | 86.694  | 86.3601 | 86.0139 | 85.6523 | 85.2749 | 84.8822 | 84.414  | 83.8894 | 83.3756 | 83.021  | 82.6583 | 82.2921 | 81.9171 | 81.5384 | 81.1868 | 80.8308 | 80.4731 | 80.1608 | 79.8626 | 79.5447 | 79.227  | 78.8885 | 78.5385 | 78.1661 | 77.8015 | 77.4433 | 77.0822 | 76.734  | 76.3758 | 76.0458 | 75.7286 | 75.4289 | 75.1521 | 74.8882 | 74.6329 | 74.3672 | 74.1135 | 73.8593 | 73.597  | 73.3102 | 73.0312 | 72.7408 | 72.4372 | 72.1118 | 71.7723 | 71.4194 | 71.0363 | 70.6565 | 70.2828 | 69.917  | 69.5547 | 69.1907 | 68.8169 | 68.4282 | 68.0244 | 67.6071 |
| Liechtenstein                                | LIE            | Rural population (% of total population) | SP.RUR.TOTL.ZS   | 79.563  | 79.685  | 79.898  | 80.11   | 80.321  | 80.529  | 80.736  | 80.941  | 81.145  | 81.346  | 81.547  | 81.636  | 81.646  | 81.656  | 81.666  | 81.676  | 81.686  | 81.696  | 81.706  | 81.716  | 81.726  | 81.813  | 81.957  | 82.099  | 82.241  | 82.381  | 82.521  | 82.66   | 82.799  | 82.936  | 83.072  | 83.179  | 83.264  | 83.349  | 83.434  | 83.518  | 83.71   | 84.006  | 84.298  | 84.586  | 84.87   | 85.038  | 85.094  | 85.15   | 85.205  | 85.261  | 85.316  | 85.371  | 85.426  | 85.481  | 85.536  | 85.59   | 85.635  | 85.67   | 85.695  | 85.711  | 85.717  | 85.714  |
| Sri Lanka                                    | LKA            | Rural population (% of total population) | SP.RUR.TOTL.ZS   | 83.569  | 83.408  | 83.247  | 83.084  | 82.733  | 82.374  | 82.008  | 81.636  | 81.258  | 80.875  | 80.486  | 80.09   | 80.085  | 80.23   | 80.374  | 80.517  | 80.66   | 80.801  | 80.942  | 81.082  | 81.221  | 81.324  | 81.336  | 81.348  | 81.361  | 81.373  | 81.385  | 81.398  | 81.41   | 81.422  | 81.434  | 81.447  | 81.459  | 81.471  | 81.484  | 81.496  | 81.508  | 81.52   | 81.533  | 81.545  | 81.557  | 81.569  | 81.582  | 81.594  | 81.606  | 81.618  | 81.63   | 81.643  | 81.655  | 81.667  | 81.679  | 81.691  | 81.703  | 81.7    | 81.68   | 81.644  | 81.593  | 81.525  |
| Lower middle income                          | LMC            | Rural population (% of total population) | SP.RUR.TOTL.ZS   | 80.3844 | 80.162  | 79.9052 | 79.6456 | 79.381  | 79.1125 | 78.8463 | 78.5716 | 78.2942 | 78.0127 | 77.728  | 77.4145 | 77.0357 | 76.6483 | 76.2563 | 76.0098 | 75.6149 | 75.2214 | 74.8234 | 74.4281 | 74.0161 | 73.6023 | 73.2674 | 72.9245 | 72.5693 | 72.207  | 71.8376 | 71.4656 | 71.0902 | 70.7189 | 70.3141 | 69.9979 | 69.6899 | 69.3822 | 69.0872 | 68.7981 | 68.5051 | 68.2039 | 67.8961 | 67.5844 | 67.2636 | 66.943  | 66.5708 | 66.1903 | 65.8021 | 65.4067 | 65.0045 | 64.5957 | 64.1802 | 63.7588 | 63.3308 | 62.8972 | 62.4551 | 62.0068 | 61.5535 | 61.0932 | 60.6285 | 60.1585 |
| Low & middle income                          | LMY            | Rural population (% of total population) | SP.RUR.TOTL.ZS   | 76.8589 | 76.3593 | 75.8785 | 75.4248 | 74.9631 | 74.7216 | 74.4896 | 74.2437 | 73.9935 | 73.7432 | 73.4942 | 73.2385 | 72.9513 | 72.6279 | 72.2671 | 71.9608 | 71.6028 | 71.241  | 70.7841 | 70.2435 | 69.6966 | 69.1414 | 68.6204 | 68.1369 | 67.6396 | 67.1398 | 66.6442 | 66.1549 | 65.6676 | 65.1928 | 64.7173 | 64.2596 | 63.8061 | 63.3542 | 62.9071 | 62.4602 | 62.0121 | 61.5576 | 61.098  | 60.6356 | 60.1651 | 59.6472 | 59.0829 | 58.5103 | 57.9316 | 57.3488 | 56.7723 | 56.1986 | 55.6191 | 55.0386 | 54.4572 | 53.8757 | 53.2993 | 52.7317 | 52.1736 | 51.6251 | 51.0869 | 50.5581 |
| Lesotho                                      | LSO            | Rural population (% of total population) | SP.RUR.TOTL.ZS   | 96.488  | 96.04   | 95.536  | 94.971  | 94.339  | 93.634  | 92.935  | 92.575  | 92.198  | 91.804  | 91.392  | 90.961  | 90.526  | 90.095  | 89.645  | 89.178  | 88.787  | 88.728  | 88.669  | 88.61   | 88.55   | 88.49   | 88.43   | 88.37   | 88.309  | 88.248  | 88.095  | 87.606  | 87.099  | 86.575  | 86.033  | 85.473  | 84.894  | 84.297  | 83.681  | 83.045  | 82.429  | 81.951  | 81.462  | 80.962  | 80.452  | 79.933  | 79.403  | 78.863  | 78.311  | 77.751  | 77.18   | 76.707  | 76.226  | 75.741  | 75.247  | 74.747  | 74.24   | 73.729  | 73.211  | 72.688  | 72.16   | 71.628  |
| Late-demographic dividend                    | LTE            | Rural population (% of total population) | SP.RUR.TOTL.ZS   | 73.8137 | 73.0534 | 72.4014 | 71.8416 | 71.2658 | 71.1591 | 71.0761 | 70.9582 | 70.8369 | 70.7238 | 70.6175 | 70.523  | 70.4111 | 70.2256 | 69.9593 | 69.6744 | 69.404  | 69.1205 | 68.6383 | 67.9655 | 67.2899 | 66.6135 | 65.943  | 65.3634 | 64.7618 | 64.1621 | 63.5713 | 62.9861 | 62.3983 | 61.826  | 61.2703 | 60.6409 | 60.0579 | 59.4025 | 58.7396 | 58.0243 | 57.3446 | 56.6475 | 55.9341 | 55.2065 | 54.458  | 53.5844 | 52.6371 | 51.6707 | 50.6882 | 49.6952 | 48.7171 | 47.7434 | 46.763  | 45.7831 | 44.8025 | 43.8247 | 42.8692 | 41.9408 | 41.0401 | 40.1669 | 39.3237 | 38.5084 |
| Lithuania                                    | LTU            | Rural population (% of total population) | SP.RUR.TOTL.ZS   | 60.54   | 59.557  | 58.565  | 57.566  | 56.559  | 55.55   | 54.535  | 53.516  | 52.493  | 51.47   | 50.445  | 49.281  | 48.032  | 46.79   | 45.549  | 44.315  | 43.085  | 41.868  | 40.658  | 39.639  | 38.842  | 38.054  | 37.27   | 36.494  | 35.723  | 34.962  | 34.207  | 33.46   | 32.72   | 32.358  | 32.417  | 32.477  | 32.536  | 32.596  | 32.655  | 32.715  | 32.775  | 32.834  | 32.894  | 32.954  | 33.014  | 33.081  | 33.172  | 33.263  | 33.354  | 33.365  | 33.294  | 33.223  | 33.152  | 33.158  | 33.243  | 33.328  | 33.396  | 33.446  | 33.478  | 33.492  | 33.488  | 33.467  |


Table #2
Filename: source_1.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              | 2016             | 2017   |
|:---------------------|:---------------|:----------------------------------------|:-----------------|:-------|:-------|:-------|:-------|:-------|:-------|:-------|:-------|:-------|:-------|:-------|:-------|:-------|:-------|:-------|:-------|:-------|:-------|:-------|:-------|:-------|:-------|:-------|:-------|:-------|:-------|:-------|:-------|:-------|:-------|:--------------------|:--------------------|:--------------------|:--------------------|:--------------------|:--------------------|:--------------------|:--------------------|:-------------------|:------------------|:-------------------|:------------------|:------------------|:-------------------|:------------------|:-------------------|:-------------------|:-----------------|:-----------------|:-------------------|:-----------------|:------------------|:------------------|:------------------|:------------------|:------------------|:-----------------|:-------|
| Aruba                | ABW            | Access to electricity (% of population) | EG.ELC.ACCS.ZS   |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        | 88.4453506469727    | 88.7808456420898    | 89.1158294677734    | 89.44775390625      | 89.7735595703125    | 90.0901870727539    | 90.3945846557617    | 90.6836776733398    | 90.9544219970703   | 91.2037506103516  | 91.6603980031457   | 91.63809204101558 | 91.8337173461914  | 92.0230484008789   | 92.21216583251949 | 92.4071197509765   | 92.61398315429692  | 92.8388214111328 | 93.086166381836  | 93.3545455932617   | 93.3562921509542 | 93.94237518310551 | 94.2558135986328  | 94.5782623291016  | 94.9067230224609  | 95.2381820678711  | 95.5701446533203 |        |
| Afghanistan          | AFG            | Access to electricity (% of population) | EG.ELC.ACCS.ZS   |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        | 0.00999999977648258 | 0.00999999977648258 | 0.00999999977648258 | 0.00999999977648258 | 0.00999999977648258 | 0.00999999977648258 | 0.00999999977648258 | 0.00999999977648258 | 0.0219771377742291 | 0.179634585976601 | 0.959755897521973  | 0.77653694152832  | 6.267393589019769 | 11.751966476440401 | 17.2363185882568  | 23.0               | 28.228612899780302 | 33.7486801147461 | 42.4             | 44.854885101318395 | 42.7             | 43.22201890820371 | 69.1              | 67.25955200195311 | 89.5              | 71.5              | 84.1371383666992 |        |
| Angola               | AGO            | Access to electricity (% of population) | EG.ELC.ACCS.ZS   |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        | 11.397808074951199  | 12.5793790817261    | 13.7604398727417    | 14.9384412765503    | 16.1103248596191    | 17.2730312347412    | 18.4235019683838    | 19.5586757659912    | 20.675495147705103 | 21.7709007263184  | 22.843355178832997 | 20.0              | 24.939094543457   | 25.9745082855225   | 27.0097007751465  | 28.050735473632802 | 29.1036758422852   | 37.5             | 31.2680130004883 | 32.3824691772461   | 33.514949798584  | 34.6              | 35.821964263916   | 36.9904899597168  | 32.0              | 42.0              | 40.5206069946289 |        |
| Albania              | ALB            | Access to electricity (% of population) | EG.ELC.ACCS.ZS   |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        | 100.0               | 100.0               | 100.0               | 100.0               | 100.0               | 100.0               | 100.0               | 100.0               | 100.0              | 100.0             | 100.0              | 100.0             | 100.0             | 100.0              | 100.0             | 100.0              | 100.0              | 100.0            | 100.0            | 100.0              | 100.0            | 100.0             | 100.0             | 100.0             | 100.0             | 100.0             | 100.0            |        |
| Andorra              | AND            | Access to electricity (% of population) | EG.ELC.ACCS.ZS   |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        | 100.0               | 100.0               | 100.0               | 100.0               | 100.0               | 100.0               | 100.0               | 100.0               | 100.0              | 100.0             | 100.0              | 100.0             | 100.0             | 100.0              | 100.0             | 100.0              | 100.0              | 100.0            | 100.0            | 100.0              | 100.0            | 100.0             | 100.0             | 100.0             | 100.0             | 100.0             | 100.0            |        |
| Arab World           | ARB            | Access to electricity (% of population) | EG.ELC.ACCS.ZS   |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        | 74.3842390444175    | 74.38222008801621   | 74.3131602867208    | 75.3493248355472    | 75.7885216921504    | 76.214137971973     | 77.20514987247721   | 77.5737299371645    | 78.39551105118579  | 78.9655316665757  | 78.7623297831137   | 80.1492565068256  | 80.35997843043671 | 81.35478764291192  | 82.66240234337971 | 83.6875762079726   | 85.8002961272357   | 84.7357232408233 | 85.4328268149662 | 85.1898151220048   | 86.1361336464124 | 86.782683284186   | 87.28824394021481 | 88.38970514764799 | 88.07677413801581 | 88.5179673938546  | 88.7686540243445 |        |
| United Arab Emirates | ARE            | Access to electricity (% of population) | EG.ELC.ACCS.ZS   |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        | 100.0               | 100.0               | 100.0               | 100.0               | 100.0               | 100.0               | 100.0               | 100.0               | 100.0              | 100.0             | 100.0              | 100.0             | 100.0             | 100.0              | 100.0             | 100.0              | 100.0              | 100.0            | 100.0            | 100.0              | 100.0            | 100.0             | 100.0             | 100.0             | 100.0             | 100.0             | 100.0            |        |
| Argentina            | ARG            | Access to electricity (% of population) | EG.ELC.ACCS.ZS   |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        | 90.6408233642578    | 91.1236724853516    | 91.60601806640629   | 92.0853042602539    | 92.5584716796875    | 93.0224609375       | 93.47421264648442   | 93.91067504882808   | 94.3287734985352   | 94.7254638671875  | 95.0992050170898   | 95.5110634674458  | 95.7975082397461  | 96.1342086791992   | 96.4706802368164  | 96.81299591064449  | 97.1672210693359   | 97.5394134521484 | 97.9341278076172 | 98.3633651733398   | 98.82            | 99.2161636352539  | 99.58441162109379 | 99.83712768554692 | 99.9592437744141  | 99.99520874023442 | 100.0            |        |
| Armenia              | ARM            | Access to electricity (% of population) | EG.ELC.ACCS.ZS   |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        | 97.6803741455078    | 97.8535919189453    | 98.02389526367192   | 98.19134521484379   | 98.35260009765621   | 98.5046539306641    | 98.64447021484379   | 98.7690277099609    | 98.8755035400391   | 98.96206665039058 | 98.9               | 100.0             | 98.0              | 99.1483154296875   | 99.17969512939449 | 99.8               | 99.2657318115234   | 99.3310394287109 | 99.4156494140625 | 99.5198135375976   | 99.8             | 99.76715087890621 | 99.87887573242192 | 99.9540557861328  | 99.9889755249023  | 100.0             | 100.0            |        |
| American Samoa       | ASM            | Access to electricity (% of population) | EG.ELC.ACCS.ZS   |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |        |                     |                     |                     |                     |                     |                     |                     |                     |                    |                   |                    |                   |                   |                    |                   |                    |                    |                  |                  |                    |                  |                   |                   |                   |                   |                   |                  |        |


Target Schema:
| Country Name         | Country Code   | Year           | Rural Value                              | Electricity Value                       |
|:---------------------|:---------------|:---------------|:-----------------------------------------|:----------------------------------------|
| Aruba                | ABW            | Indicator Name | Rural population (% of total population) | Access to electricity (% of population) |
| Afghanistan          | AFG            | Indicator Name | Rural population (% of total population) | Access to electricity (% of population) |
| Angola               | AGO            | Indicator Name | Rural population (% of total population) | Access to electricity (% of population) |
| Albania              | ALB            | Indicator Name | Rural population (% of total population) | Access to electricity (% of population) |
| Andorra              | AND            | Indicator Name | Rural population (% of total population) | Access to electricity (% of population) |
| Arab World           | ARB            | Indicator Name | Rural population (% of total population) | Access to electricity (% of population) |
| United Arab Emirates | ARE            | Indicator Name | Rural population (% of total population) | Access to electricity (% of population) |
| Argentina            | ARG            | Indicator Name | Rural population (% of total population) | Access to electricity (% of population) |
| Armenia              | ARM            | Indicator Name | Rural population (% of total population) | Access to electricity (% of population) |
| American Samoa       | ASM            | Indicator Name | Rural population (% of total population) | Access to electricity (% of population) |

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
test: test_0.csv
test_1.csv