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 |
|:---------------|----------:|:--------------------|------------:|------------:|-------:|
| 8600000US43529 |     43529 | ZCTA5 43529         |         280 |         102 |   2014 |
| 8600000US15017 |     15017 | ZCTA5 15017         |       15830 |         695 |   2014 |
| 8600000US77401 |     77401 | ZCTA5 77401         |       18130 |         167 |   2014 |
| 8600000US92342 |     92342 | ZCTA5 92342         |        6303 |         915 |   2014 |
| 8600000US63767 |     63767 | ZCTA5 63767         |         737 |         163 |   2014 |
| 8600000US96065 |     96065 | ZCTA5 96065         |         387 |         156 |   2014 |
| 8600000US60084 |     60084 | ZCTA5 60084         |       15867 |         544 |   2014 |
| 8600000US90211 |     90211 | ZCTA5 90211         |        8080 |         518 |   2014 |
| 8600000US12184 |     12184 | ZCTA5 12184         |        6851 |         555 |   2014 |
| 8600000US36035 |     36035 | ZCTA5 36035         |        1784 |         246 |   2014 |


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 |
|:---------------|----------:|:--------------------|------------:|------------:|-------:|
| 8600000US74867 |     74867 | ZCTA5 74867         |        1077 |         194 |   2013 |
| 8600000US03225 |     03225 | ZCTA5 03225         |        3700 |         262 |   2013 |
| 8600000US62875 |     62875 | ZCTA5 62875         |        1110 |         189 |   2013 |
| 8600000US58477 |     58477 | ZCTA5 58477         |         193 |          82 |   2013 |
| 8600000US04976 |     04976 | ZCTA5 04976         |        9874 |         159 |   2013 |
| 8600000US54850 |     54850 | ZCTA5 54850         |         180 |          61 |   2013 |
| 8600000US87064 |     87064 | ZCTA5 87064         |         111 |          65 |   2013 |
| 8600000US26586 |     26586 | ZCTA5 26586         |           0 |          11 |   2013 |
| 8600000US49935 |     49935 | ZCTA5 49935         |        6234 |         208 |   2013 |
| 8600000US53083 |     53083 | ZCTA5 53083         |       20581 |         752 |   2013 |


Table #4
Filename: source_3.csv
Sample Rows in Markdown:
| GEO.id         |   GEO.id2 | GEO.display-label   |   HD01_VD01 |   HD02_VD01 |   Year |
|:---------------|----------:|:--------------------|------------:|------------:|-------:|
| 8600000US61865 |     61865 | ZCTA5 61865         |        1284 |         204 |   2015 |
| 8600000US55031 |     55031 | ZCTA5 55031         |        2206 |         168 |   2015 |
| 8600000US62431 |     62431 | ZCTA5 62431         |        1056 |         233 |   2015 |
| 8600000US64451 |     64451 | ZCTA5 64451         |         463 |          83 |   2015 |
| 8600000US73659 |     73659 | ZCTA5 73659         |         203 |          79 |   2015 |
| 8600000US02917 |     02917 | ZCTA5 02917         |       14017 |         470 |   2015 |
| 8600000US02191 |     02191 | ZCTA5 02191         |        8352 |         412 |   2015 |
| 8600000US33859 |     33859 | ZCTA5 33859         |        9950 |        1354 |   2015 |
| 8600000US72738 |     72738 | ZCTA5 72738         |        2518 |         452 |   2015 |
| 8600000US92358 |     92358 | ZCTA5 92358         |        1111 |         302 |   2015 |


Table #5
Filename: source_4.csv
Sample Rows in Markdown:
| GEO.id         |   GEO.id2 | GEO.display-label   |   HD01_VD01 |   HD02_VD01 |   Year |
|:---------------|----------:|:--------------------|------------:|------------:|-------:|
| 8600000US85048 |     85048 | ZCTA5 85048         |       35621 |        1146 |   2016 |
| 8600000US84330 |     84330 | ZCTA5 84330         |         431 |          87 |   2016 |
| 8600000US96112 |     96112 | ZCTA5 96112         |         332 |         129 |   2016 |
| 8600000US36720 |     36720 | ZCTA5 36720         |         889 |         307 |   2016 |
| 8600000US24954 |     24954 | ZCTA5 24954         |        3800 |         280 |   2016 |
| 8600000US87527 |     87527 | ZCTA5 87527         |         748 |         501 |   2016 |
| 8600000US48871 |     48871 | ZCTA5 48871         |        2054 |         195 |   2016 |
| 8600000US40202 |     40202 | ZCTA5 40202         |        6411 |         437 |   2016 |
| 8600000US71635 |     71635 | ZCTA5 71635         |       12306 |         467 |   2016 |
| 8600000US50857 |     50857 | ZCTA5 50857         |         215 |          56 |   2016 |


Target Schema:
| GEO.display-label   |   GEO.id |   GEO.id2 |   HD01_VD01 |   HD02_VD01 |   Year |
|:--------------------|---------:|----------:|------------:|------------:|-------:|
| Geography           |        5 |         5 |           5 |           5 |      5 |
| ZCTA5 00601         |        5 |         5 |           5 |           5 |      5 |
| ZCTA5 00602         |        5 |         5 |           5 |           5 |      5 |
| ZCTA5 00603         |        5 |         5 |           5 |           5 |      5 |
| ZCTA5 00606         |        5 |         5 |           5 |           5 |      5 |
| ZCTA5 00610         |        5 |         5 |           5 |           5 |      5 |
| ZCTA5 00612         |        5 |         5 |           5 |           5 |      5 |
| ZCTA5 00616         |        5 |         5 |           5 |           5 |      5 |
| ZCTA5 00617         |        5 |         5 |           5 |           5 |      5 |
| ZCTA5 00622         |        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