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:
| Drug      |   Timepoint |   Mean of Tumor Volume (mm3) |   Mouse ID |   SEM of Tumor Volume (mm3) |   Metastatic Sites |
|:----------|------------:|-----------------------------:|-----------:|----------------------------:|-------------------:|
| Capomulin |           0 |                      45      |         25 |                          25 |                 25 |
| Capomulin |           5 |                      44.2661 |         25 |                          25 |                 25 |
| Capomulin |          10 |                      43.0843 |         25 |                          25 |                 25 |
| Capomulin |          15 |                      42.0643 |         24 |                          24 |                 24 |
| Capomulin |          20 |                      37.5055 |          5 |                           5 |                  5 |
| Ceftamin  |           0 |                      45      |         25 |                          25 |                 25 |
| Ceftamin  |           5 |                      46.5031 |         21 |                          21 |                 21 |
| Ceftamin  |          10 |                      48.2851 |         20 |                          20 |                 20 |
| Ceftamin  |          15 |                      50.0941 |         19 |                          19 |                 19 |
| Infubinol |           0 |                      45      |         25 |                          25 |                 25 |

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