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:
| GEO.id         |   GEO.id2 | GEO.display-label   |   HD01_VD01 |   HD02_VD01 |   Year |
|:---------------|----------:|:--------------------|------------:|------------:|-------:|
| 8600000US41859 |     41859 | ZCTA5 41859         |         336 |          93 |   2015 |
| 8600000US04645 |      4645 | ZCTA5 04645         |          63 |          39 |   2015 |
| 8600000US72019 |     72019 | ZCTA5 72019         |       23987 |        1093 |   2015 |
| 8600000US39877 |     39877 | ZCTA5 39877         |         379 |         140 |   2015 |
| 8600000US66205 |     66205 | ZCTA5 66205         |       13994 |         313 |   2015 |
| 8600000US97478 |     97478 | ZCTA5 97478         |       38604 |        1088 |   2015 |
| 8600000US08608 |      8608 | ZCTA5 08608         |         676 |         276 |   2015 |
| 8600000US75558 |     75558 | ZCTA5 75558         |        1555 |         444 |   2015 |
| 8600000US36606 |     36606 | ZCTA5 36606         |       19135 |         885 |   2015 |
| 8600000US46107 |     46107 | ZCTA5 46107         |       12125 |         508 |   2015 |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
| GEO.id         |   GEO.id2 | GEO.display-label   |   HD01_VD01 |   HD02_VD01 |   Year |
|:---------------|----------:|:--------------------|------------:|------------:|-------:|
| 8600000US49738 |     49738 | ZCTA5 49738         |        9962 |         266 |   2012 |
| 8600000US49740 |     49740 | ZCTA5 49740         |        6805 |         266 |   2012 |
| 8600000US49743 |     49743 | ZCTA5 49743         |         786 |         120 |   2012 |
| 8600000US49744 |     49744 | ZCTA5 49744         |         822 |         154 |   2012 |
| 8600000US49745 |     49745 | ZCTA5 49745         |        1264 |         221 |   2012 |
| 8600000US49746 |     49746 | ZCTA5 49746         |        3700 |         236 |   2012 |
| 8600000US49747 |     49747 | ZCTA5 49747         |        1784 |         167 |   2012 |
| 8600000US49748 |     49748 | ZCTA5 49748         |         138 |          36 |   2012 |
| 8600000US49749 |     49749 | ZCTA5 49749         |        4166 |         321 |   2012 |
| 8600000US49751 |     49751 | ZCTA5 49751         |        1747 |         169 |   2012 |


Table #3
Filename: source_2.csv
Sample Rows in Markdown:
| GEO.id         |   GEO.id2 | GEO.display-label   |   HD01_VD01 |   HD02_VD01 |   Year |
|:---------------|----------:|:--------------------|------------:|------------:|-------:|
| 8600000US29329 |     29329 | ZCTA5 29329         |         242 |         144 |   2016 |
| 8600000US47567 |     47567 | ZCTA5 47567         |        5944 |         260 |   2016 |
| 8600000US48128 |     48128 | ZCTA5 48128         |       10640 |         461 |   2016 |
| 8600000US71110 |     71110 | ZCTA5 71110         |        4515 |         638 |   2016 |
| 8600000US71842 |     71842 | ZCTA5 71842         |        2113 |         334 |   2016 |
| 8600000US27536 |     27536 | ZCTA5 27536         |       16685 |         593 |   2016 |
| 8600000US95306 |     95306 | ZCTA5 95306         |         823 |         207 |   2016 |
| 8600000US98230 |     98230 | ZCTA5 98230         |       15906 |         951 |   2016 |
| 8600000US98304 |     98304 | ZCTA5 98304         |         602 |         198 |   2016 |
| 8600000US39478 |     39478 | ZCTA5 39478         |        2283 |         501 |   2016 |


Table #4
Filename: source_3.csv
Sample Rows in Markdown:
| GEO.id         |   GEO.id2 | GEO.display-label   |   HD01_VD01 |   HD02_VD01 |   Year |
|:---------------|----------:|:--------------------|------------:|------------:|-------:|
| 8600000US39565 |     39565 | ZCTA5 39565         |       19040 |        1083 |   2013 |
| 8600000US97736 |     97736 | ZCTA5 97736         |         175 |          73 |   2013 |
| 8600000US11520 |     11520 | ZCTA5 11520         |       43472 |         266 |   2013 |
| 8600000US31015 |     31015 | ZCTA5 31015         |       22347 |         213 |   2013 |
| 8600000US42764 |     42764 | ZCTA5 42764         |         462 |         171 |   2013 |
| 8600000US37042 |     37042 | ZCTA5 37042         |       68419 |        1644 |   2013 |
| 8600000US02067 |      2067 | ZCTA5 02067         |       17591 |         114 |   2013 |
| 8600000US45233 |     45233 | ZCTA5 45233         |       15674 |         790 |   2013 |
| 8600000US83436 |     83436 | ZCTA5 83436         |         334 |         111 |   2013 |
| 8600000US17217 |     17217 | ZCTA5 17217         |          91 |          48 |   2013 |


Table #5
Filename: source_4.csv
Sample Rows in Markdown:
| GEO.id         |   GEO.id2 | GEO.display-label   |   HD01_VD01 |   HD02_VD01 |   Year |
|:---------------|----------:|:--------------------|------------:|------------:|-------:|
| 8600000US25880 |     25880 | ZCTA5 25880         |        6421 |         571 |   2014 |
| 8600000US47282 |     47282 | ZCTA5 47282         |         265 |         100 |   2014 |
| 8600000US47012 |     47012 | ZCTA5 47012         |       10382 |         494 |   2014 |
| 8600000US18342 |     18342 | ZCTA5 18342         |         385 |         236 |   2014 |
| 8600000US28586 |     28586 | ZCTA5 28586         |        7393 |         558 |   2014 |
| 8600000US85140 |     85140 | ZCTA5 85140         |       39508 |        2577 |   2014 |
| 8600000US93901 |     93901 | ZCTA5 93901         |       26438 |        1061 |   2014 |
| 8600000US54023 |     54023 | ZCTA5 54023         |        3980 |         214 |   2014 |
| 8600000US67036 |     67036 | ZCTA5 67036         |          79 |          33 |   2014 |
| 8600000US56120 |     56120 | ZCTA5 56120         |        1118 |         106 |   2014 |


Target Schema:
| GEO.id         | GEO.id2   | GEO.display-label   | HD01_VD01       | HD02_VD01              |   Year |
|:---------------|:----------|:--------------------|:----------------|:-----------------------|-------:|
| Id             | Id2       | Geography           | Estimate; Total | Margin of Error; Total |   2012 |
| 8600000US00601 | 601.0     | ZCTA5 00601         | 18544.0         | 271.0                  |   2012 |
| 8600000US00602 | 602.0     | ZCTA5 00602         | 41640.0         | 147.0                  |   2012 |
| 8600000US00603 | 603.0     | ZCTA5 00603         | 54540.0         | 735.0                  |   2012 |
| 8600000US00606 | 606.0     | ZCTA5 00606         | 6593.0          | 270.0                  |   2012 |
| 8600000US00610 | 610.0     | ZCTA5 00610         | 29141.0         | 180.0                  |   2012 |
| 8600000US00612 | 612.0     | ZCTA5 00612         | 69017.0         | 1500.0                 |   2012 |
| 8600000US00616 | 616.0     | ZCTA5 00616         | 10750.0         | 1084.0                 |   2012 |
| 8600000US00617 | 617.0     | ZCTA5 00617         | 24733.0         | 171.0                  |   2012 |
| 8600000US00622 | 622.0     | ZCTA5 00622         | 5923.0          | 984.0                  |   2012 |

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
source_3.csv
source_4.csv
test: test_0.csv
test_1.csv
test_2.csv
test_3.csv
test_4.csv