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:
| State          | Participation   |   Evidence-Based Reading and Writing |   Math |   Total |
|:---------------|:----------------|-------------------------------------:|-------:|--------:|
| Missouri       | 3%              |                                  640 |    631 |    1271 |
| Montana        | 10%             |                                  605 |    591 |    1196 |
| Nebraska       | 3%              |                                  629 |    625 |    1253 |
| Nevada         | 26%             |                                  563 |    553 |    1116 |
| New Hampshire  | 96%             |                                  532 |    520 |    1052 |
| New Jersey     | 70%             |                                  530 |    526 |    1056 |
| New Mexico     | 11%             |                                  577 |    561 |    1138 |
| New York       | 67%             |                                  528 |    523 |    1052 |
| North Carolina | 49%             |                                  546 |    535 |    1081 |
| North Dakota   | 2%              |                                  635 |    621 |    1256 |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
| State                | Participation   |   English |   Math |   Reading |   Science |   Composite |
|:---------------------|:----------------|----------:|-------:|----------:|----------:|------------:|
| National             | 60%             |      20.3 |   20.7 |      21.4 |      21   |        21   |
| Alabama              | 100%            |      18.9 |   18.4 |      19.7 |      19.4 |        19.2 |
| Alaska               | 65%             |      18.7 |   19.8 |      20.4 |      19.9 |        19.8 |
| Arizona              | 62%             |      18.6 |   19.8 |      20.1 |      19.8 |        19.7 |
| Arkansas             | 100%            |      18.9 |   19   |      19.7 |      19.5 |        19.4 |
| California           | 31%             |      22.5 |   22.7 |      23.1 |      22.2 |        22.8 |
| Colorado             | 100%            |      20.1 |   20.3 |      21.2 |      20.9 |        20.8 |
| Connecticut          | 31%             |      25.5 |   24.6 |      25.6 |      24.6 |        25.2 |
| Delaware             | 18%             |      24.1 |   23.4 |      24.8 |      23.6 |        24.1 |
| District of Columbia | 32%             |      24.4 |   23.5 |      24.9 |      23.5 |        24.2 |


Target Schema:
| State                | Participation_x   |   Evidence-Based Reading and Writing |   Math_x |   Total | Participation_y   |   English |   Math_y |   Reading |   Science |   Composite |
|:---------------------|:------------------|-------------------------------------:|---------:|--------:|:------------------|----------:|---------:|----------:|----------:|------------:|
| Alabama              | 5%                |                                  593 |      572 |    1165 | 100%              |      18.9 |     18.4 |      19.7 |      19.4 |        19.2 |
| Alaska               | 38%               |                                  547 |      533 |    1080 | 65%               |      18.7 |     19.8 |      20.4 |      19.9 |        19.8 |
| Arizona              | 30%               |                                  563 |      553 |    1116 | 62%               |      18.6 |     19.8 |      20.1 |      19.8 |        19.7 |
| Arkansas             | 3%                |                                  614 |      594 |    1208 | 100%              |      18.9 |     19   |      19.7 |      19.5 |        19.4 |
| California           | 53%               |                                  531 |      524 |    1055 | 31%               |      22.5 |     22.7 |      23.1 |      22.2 |        22.8 |
| Colorado             | 11%               |                                  606 |      595 |    1201 | 100%              |      20.1 |     20.3 |      21.2 |      20.9 |        20.8 |
| Connecticut          | 100%              |                                  530 |      512 |    1041 | 31%               |      25.5 |     24.6 |      25.6 |      24.6 |        25.2 |
| Delaware             | 100%              |                                  503 |      492 |     996 | 18%               |      24.1 |     23.4 |      24.8 |      23.6 |        24.1 |
| District of Columbia | 100%              |                                  482 |      468 |     950 | 32%               |      24.4 |     23.5 |      24.9 |      23.5 |        24.2 |
| Florida              | 83%               |                                  520 |      497 |    1017 | 73%               |      19   |     19.4 |      21   |      19.4 |        19.8 |

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