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:
|   Student ID | student_name        | gender   | grade   | school_name        |   reading_score |   math_score |
|-------------:|:--------------------|:---------|:--------|:-------------------|----------------:|-------------:|
|        19585 | Alicia Butler       | F        | 9th     | Bailey High School |              69 |           71 |
|        19586 | Amanda Adams        | F        | 11th    | Bailey High School |              91 |           83 |
|        19587 | James Brown         | M        | 9th     | Bailey High School |              76 |           92 |
|        19588 | Anthony Holmes      | M        | 11th    | Bailey High School |              86 |           76 |
|        19589 | Jacqueline Williams | F        | 10th    | Bailey High School |              79 |           75 |
|        19590 | Julie Brown         | F        | 11th    | Bailey High School |              94 |           99 |
|        19591 | Scott Gibson        | M        | 11th    | Bailey High School |              91 |           71 |
|        19592 | Anthony Reeves      | M        | 12th    | Bailey High School |              99 |           60 |
|        19593 | Diane Vargas        | F        | 9th     | Bailey High School |              99 |           80 |
|        19594 | Kathryn Jones       | F        | 10th    | Bailey High School |              73 |           97 |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
|   School ID | school_name           | type     |   size |   budget |
|------------:|:----------------------|:---------|-------:|---------:|
|           0 | Huang High School     | District |   2917 |  1910635 |
|           1 | Figueroa High School  | District |   2949 |  1884411 |
|           2 | Shelton High School   | Charter  |   1761 |  1056600 |
|           3 | Hernandez High School | District |   4635 |  3022020 |
|           4 | Griffin High School   | Charter  |   1468 |   917500 |
|           5 | Wilson High School    | Charter  |   2283 |  1319574 |
|           6 | Cabrera High School   | Charter  |   1858 |  1081356 |
|           7 | Bailey High School    | District |   4976 |  3124928 |
|           8 | Holden High School    | Charter  |    427 |   248087 |
|           9 | Pena High School      | Charter  |    962 |   585858 |


Target Schema:
| school_name           |    10th |    11th |    12th |     9th |
|:----------------------|--------:|--------:|--------:|--------:|
| Bailey High School    | 76.4563 | 78.3063 | 76.6773 | 76.907  |
| Cabrera High School   | 83.1545 | 82.7656 | 83.2775 | 83.0947 |
| Figueroa High School  | 76.54   | 76.8843 | 77.1514 | 76.403  |
| Griffin High School   | 84.2291 | 83.8421 | 83.3562 | 82.044  |
| Hernandez High School | 77.3374 | 77.136  | 77.1866 | 77.4385 |
| Huang High School     | 75.9087 | 76.4466 | 77.2256 | 77.0273 |
| Shelton High School   | 82.9174 | 83.3835 | 83.779  | 83.4208 |
| Wilson High School    | 83.7244 | 83.1953 | 83.0358 | 83.0856 |

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