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 |
|:---------------|----------:|:--------------------|------------:|------------:|-------:|
| 8600000US78677 |     78677 | ZCTA5 78677         |         101 |          74 |   2013 |
| 8600000US65552 |     65552 | ZCTA5 65552         |        2117 |         491 |   2013 |
| 8600000US49709 |     49709 | ZCTA5 49709         |        3693 |         239 |   2013 |
| 8600000US50440 |     50440 | ZCTA5 50440         |         475 |         103 |   2013 |
| 8600000US94024 |     94024 | ZCTA5 94024         |       22349 |         644 |   2013 |
| 8600000US94520 |     94520 | ZCTA5 94520         |       37489 |        1204 |   2013 |
| 8600000US61104 |     61104 | ZCTA5 61104         |       18345 |        1151 |   2013 |
| 8600000US45716 |     45716 | ZCTA5 45716         |         434 |         104 |   2013 |
| 8600000US93442 |     93442 | ZCTA5 93442         |       10896 |         293 |   2013 |
| 8600000US32193 |     32193 | ZCTA5 32193         |        1191 |         329 |   2013 |


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 |
|:---------------|----------:|:--------------------|------------:|:------------|-------:|
| 8600000US35952 |     35952 | ZCTA5 35952         |        7185 | 802         |   2015 |
| 8600000US39767 |     39767 | ZCTA5 39767         |         544 | 160         |   2015 |
| 8600000US61337 |     61337 | ZCTA5 61337         |         475 | 142         |   2015 |
| 8600000US96097 |     96097 | ZCTA5 96097         |        9860 | 297         |   2015 |
| 8600000US37033 |     37033 | ZCTA5 37033         |        7621 | 462         |   2015 |
| 8600000US79011 |     79011 | ZCTA5 79011         |         267 | 70          |   2015 |
| 8600000US78832 |     78832 | ZCTA5 78832         |        3577 |             |   2015 |
| 8600000US66956 |     66956 | ZCTA5 66956         |        1083 | 112         |   2015 |
| 8600000US36401 |     36401 | ZCTA5 36401         |        7862 | 431         |   2015 |
| 8600000US32465 |     32465 | ZCTA5 32465         |        8591 | 449         |   2015 |


Table #4
Filename: source_3.csv
Sample Rows in Markdown:
| GEO.id         |   GEO.id2 | GEO.display-label   |   HD01_VD01 |   HD02_VD01 |   Year |
|:---------------|----------:|:--------------------|------------:|------------:|-------:|
| 8600000US62257 |     62257 | ZCTA5 62257         |        3139 |         365 |   2014 |
| 8600000US19106 |     19106 | ZCTA5 19106         |       11474 |         916 |   2014 |
| 8600000US28678 |     28678 | ZCTA5 28678         |        5321 |         765 |   2014 |
| 8600000US20685 |     20685 | ZCTA5 20685         |        6313 |         523 |   2014 |
| 8600000US66757 |     66757 | ZCTA5 66757         |        3365 |         263 |   2014 |
| 8600000US90058 |     90058 | ZCTA5 90058         |        2748 |         481 |   2014 |
| 8600000US50529 |     50529 | ZCTA5 50529         |         764 |         121 |   2014 |
| 8600000US35577 |     35577 | ZCTA5 35577         |          32 |          23 |   2014 |
| 8600000US24347 |     24347 | ZCTA5 24347         |        1800 |         401 |   2014 |
| 8600000US13051 |     13051 | ZCTA5 13051         |         129 |         185 |   2014 |


Table #5
Filename: source_4.csv
Sample Rows in Markdown:
| GEO.id         |   GEO.id2 | GEO.display-label   |   HD01_VD01 |   HD02_VD01 |   Year |
|:---------------|----------:|:--------------------|------------:|------------:|-------:|
| 8600000US60124 |     60124 | ZCTA5 60124         |       20761 |        1291 |   2016 |
| 8600000US36732 |     36732 | ZCTA5 36732         |        8328 |         379 |   2016 |
| 8600000US71407 |     71407 | ZCTA5 71407         |         763 |         264 |   2016 |
| 8600000US04773 |      4773 | ZCTA5 04773         |         626 |         177 |   2016 |
| 8600000US21645 |     21645 | ZCTA5 21645         |        1058 |         284 |   2016 |
| 8600000US26426 |     26426 | ZCTA5 26426         |        7429 |         588 |   2016 |
| 8600000US49117 |     49117 | ZCTA5 49117         |        3837 |         299 |   2016 |
| 8600000US39341 |     39341 | ZCTA5 39341         |        7470 |         500 |   2016 |
| 8600000US64496 |     64496 | ZCTA5 64496         |          45 |          20 |   2016 |
| 8600000US47857 |     47857 | ZCTA5 47857         |         551 |         209 |   2016 |


Target Schema:
|   GEO.id2 |   GEO.id |   GEO.display-label |   HD01_VD01 |   HD02_VD01 |   Year |
|----------:|---------:|--------------------:|------------:|------------:|-------:|
|     00601 |        5 |                   5 |           5 |           5 |      5 |
|     00602 |        5 |                   5 |           5 |           5 |      5 |
|     00603 |        5 |                   5 |           5 |           5 |      5 |
|     00606 |        5 |                   5 |           5 |           5 |      5 |
|     00610 |        5 |                   5 |           5 |           5 |      5 |
|     00612 |        5 |                   5 |           5 |           5 |      5 |
|     00616 |        5 |                   5 |           5 |           5 |      5 |
|     00617 |        5 |                   5 |           5 |           5 |      5 |
|     00622 |        5 |                   5 |           5 |           5 |      5 |
|     00623 |        5 |                   5 |           5 |           5 |      5 |

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