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:
|   Unnamed: 1 | age_grp   |   Count | Notes   |   Rate | Statistics   |
|-------------:|:----------|--------:|:--------|-------:|:-------------|
|         2005 | 1-4       |      21 |         |  13.65 |              |
|         2006 | 1-4       |      13 |         |   8.46 |              |
|         2007 | 1-4       |      21 |         |  15.16 |              |
|         2008 | 1-4       |      15 |         |   9.74 |              |
|         2009 | 1-4       |      22 |         |  13.31 |              |
|         2010 | 1-4       |      18 |         |  11.21 |              |
|         2011 | 1-4       |      23 |         |  14.69 |              |
|         2012 | 1-4       |       7 |         |   4.55 |              |
|         2013 | 1-4       |      14 |         |   9.61 |              |
|         2014 | 1-4       |      15 |         |  10.23 |              |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
| Unnamed: 1   | age_grp   | Count   | Notes   | Rate   | Statistics   |
|:-------------|:----------|:--------|:--------|:-------|:-------------|
| Year         | 0-1       |         |         |        | County       |
| Year         | 0-1       |         |         |        | Adair        |
| Year         | 0-1       |         |         |        | Andrew       |
| Year         | 0-1       |         |         |        | Atchison     |
| Year         | 0-1       |         |         |        | Audrain      |
| Year         | 0-1       |         |         |        | Barry        |
| Year         | 0-1       |         |         |        | Barton       |
| Year         | 0-1       |         |         |        | Bates        |
| Year         | 0-1       |         |         |        | Benton       |
| Year         | 0-1       |         |         |        | Bollinger    |


Table #3
Filename: source_2.csv
Sample Rows in Markdown:
| Unnamed: 1          | age_grp   | Count   | Notes   | Rate   | Statistics   |
|:--------------------|:----------|:--------|:--------|:-------|:-------------|
| Year                | 10-14     |         |         |        | County       |
| Total for selection | 10-14     | 47.0    |         | 2.38   |              |
| Year                | 10-14     |         |         |        | Adair        |
| Total for selection | 10-14     | 16.0    | *       | 0.84   |              |
| Year                | 10-14     |         |         |        | Andrew       |
| Total for selection | 10-14     | 20.0    |         | 3.62   |              |
| Year                | 10-14     |         |         |        | Atchison     |
| Total for selection | 10-14     | 67.0    |         | 2.54   |              |
| Year                | 10-14     |         |         |        | Audrain      |
| 2001                | 10-14     |         | *       |        |              |


Table #4
Filename: source_3.csv
Sample Rows in Markdown:
| Unnamed: 1   | age_grp   | Count   | Notes   | Rate   | Statistics   |
|:-------------|:----------|:--------|:--------|:-------|:-------------|
| Year         | 5-9       |         |         |        | County       |
| Year         | 5-9       |         |         |        | Adair        |
| Year         | 5-9       |         |         |        | Andrew       |
| Year         | 5-9       |         |         |        | Atchison     |
| Year         | 5-9       |         |         |        | Audrain      |
| Year         | 5-9       |         |         |        | Barry        |
| Year         | 5-9       |         |         |        | Barton       |
| Year         | 5-9       |         |         |        | Bates        |
| Year         | 5-9       |         |         |        | Benton       |
| Year         | 5-9       |         |         |        | Bollinger    |


Table #5
Filename: source_4.csv
Sample Rows in Markdown:
| Unnamed: 1          | age_grp   | Count   | Notes   | Rate   | Statistics   |
|:--------------------|:----------|:--------|:--------|:-------|:-------------|
| Year                | 15-17     |         |         |        | County       |
| Total for selection | 15-17     | 50.0    |         | 3.99   |              |
| Year                | 15-17     |         |         |        | Adair        |
| Total for selection | 15-17     | 26.0    |         | 2.23   |              |
| Year                | 15-17     |         |         |        | Andrew       |
| Total for selection | 15-17     | 27.0    |         | 6.68   |              |
| Year                | 15-17     |         |         |        | Atchison     |
| Total for selection | 15-17     | 81.0    |         | 4.59   |              |
| Year                | 15-17     |         |         |        | Audrain      |
| Total for selection | 15-17     | 117.0   |         | 5.08   |              |


Target Schema:
| Unnamed: 1   | age_grp   | Count   | Notes   | Rate   | Statistics   |
|:-------------|:----------|:--------|:--------|:-------|:-------------|
| Year         | 0-1       |         |         |        | County       |
| Year         | 0-1       |         |         |        | Adair        |
| Year         | 0-1       |         |         |        | Andrew       |
| Year         | 0-1       |         |         |        | Atchison     |
| Year         | 0-1       |         |         |        | Audrain      |
| Year         | 0-1       |         |         |        | Barry        |
| Year         | 0-1       |         |         |        | Barton       |
| Year         | 0-1       |         |         |        | Bates        |
| Year         | 0-1       |         |         |        | Benton       |
| Year         | 0-1       |         |         |        | Bollinger    |

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