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:
| Mouse ID   |   Timepoint |   Tumor Volume (mm3) |   Metastatic Sites |
|:-----------|------------:|---------------------:|-------------------:|
| n763       |          20 |              49.2581 |                  1 |
| q787       |          20 |              50.2299 |                  2 |
| y163       |          20 |              54.5711 |                  1 |
| g570       |          20 |              54.6433 |                  1 |
| g989       |          20 |              55.3261 |                  1 |
| s141       |          20 |              51.6216 |                  1 |
| q511       |          20 |              52.6727 |                  0 |
| s121       |          20 |              52.0051 |                  2 |
| t718       |          20 |              52.6367 |                  2 |
| k210       |          20 |              51.9976 |                  0 |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
| Mouse ID   | Drug     |
|:-----------|:---------|
| f234       | Stelasyn |
| x402       | Stelasyn |
| a492       | Stelasyn |
| w540       | Stelasyn |
| v764       | Stelasyn |
| o848       | Stelasyn |
| z314       | Stelasyn |
| g989       | Stelasyn |
| m269       | Stelasyn |
| a963       | Stelasyn |


Target Schema:
|   Timepoint |   Capomulin | Ceftamin   |   Infubinol | Ketapril   | Naftisol   |   Placebo |   Propriva | Ramicane   | Stelasyn   |   Zoniferol |
|------------:|------------:|:-----------|------------:|:-----------|:-----------|----------:|-----------:|:-----------|:-----------|------------:|
|           0 |          25 | 25.0       |          25 | 25.0       | 25.0       |        25 |         26 | 25.0       | 26.0       |          25 |
|           5 |          25 | 21.0       |          25 | 23.0       | 23.0       |        24 |         25 | 25.0       | 25.0       |          24 |
|          10 |          25 | 20.0       |          21 | 22.0       | 21.0       |        24 |         23 | 24.0       | 23.0       |          22 |
|          15 |          24 | 19.0       |          21 | 19.0       | 21.0       |        20 |         17 | 24.0       | 23.0       |          21 |
|          20 |           5 |            |           8 |            |            |         4 |         10 |            |            |           1 |

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