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:
|   fixed acidity |   volatile acidity |   citric acid |   residual sugar |   chlorides |   free sulfur dioxide |   total sulfur dioxide |   density |   pH |   sulphates |   alcohol |   quality |
|----------------:|-------------------:|--------------:|-----------------:|------------:|----------------------:|-----------------------:|----------:|-----:|------------:|----------:|----------:|
|             7.4 |               0.7  |          0    |              1.9 |       0.076 |                    11 |                     34 |    0.9978 | 3.51 |        0.56 |       9.4 |         5 |
|             7.8 |               0.88 |          0    |              2.6 |       0.098 |                    25 |                     67 |    0.9968 | 3.2  |        0.68 |       9.8 |         5 |
|             7.8 |               0.76 |          0.04 |              2.3 |       0.092 |                    15 |                     54 |    0.997  | 3.26 |        0.65 |       9.8 |         5 |
|            11.2 |               0.28 |          0.56 |              1.9 |       0.075 |                    17 |                     60 |    0.998  | 3.16 |        0.58 |       9.8 |         6 |
|             7.4 |               0.7  |          0    |              1.9 |       0.076 |                    11 |                     34 |    0.9978 | 3.51 |        0.56 |       9.4 |         5 |
|             7.4 |               0.66 |          0    |              1.8 |       0.075 |                    13 |                     40 |    0.9978 | 3.51 |        0.56 |       9.4 |         5 |
|             7.9 |               0.6  |          0.06 |              1.6 |       0.069 |                    15 |                     59 |    0.9964 | 3.3  |        0.46 |       9.4 |         5 |
|             7.3 |               0.65 |          0    |              1.2 |       0.065 |                    15 |                     21 |    0.9946 | 3.39 |        0.47 |      10   |         7 |
|             7.8 |               0.58 |          0.02 |              2   |       0.073 |                     9 |                     18 |    0.9968 | 3.36 |        0.57 |       9.5 |         7 |
|             7.5 |               0.5  |          0.36 |              6.1 |       0.071 |                    17 |                    102 |    0.9978 | 3.35 |        0.8  |      10.5 |         5 |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
|   fixed acidity |   volatile acidity |   citric acid |   residual sugar |   chlorides |   free sulfur dioxide |   total sulfur dioxide |   density |   pH |   sulphates |   alcohol |   quality |
|----------------:|-------------------:|--------------:|-----------------:|------------:|----------------------:|-----------------------:|----------:|-----:|------------:|----------:|----------:|
|             7.4 |               0.7  |          0    |              1.9 |       0.076 |                    11 |                     34 |    0.9978 | 3.51 |        0.56 |       9.4 |         5 |
|             7.8 |               0.88 |          0    |              2.6 |       0.098 |                    25 |                     67 |    0.9968 | 3.2  |        0.68 |       9.8 |         5 |
|             7.8 |               0.76 |          0.04 |              2.3 |       0.092 |                    15 |                     54 |    0.997  | 3.26 |        0.65 |       9.8 |         5 |
|            11.2 |               0.28 |          0.56 |              1.9 |       0.075 |                    17 |                     60 |    0.998  | 3.16 |        0.58 |       9.8 |         6 |
|             7.4 |               0.7  |          0    |              1.9 |       0.076 |                    11 |                     34 |    0.9978 | 3.51 |        0.56 |       9.4 |         5 |
|             7.4 |               0.66 |          0    |              1.8 |       0.075 |                    13 |                     40 |    0.9978 | 3.51 |        0.56 |       9.4 |         5 |
|             7.9 |               0.6  |          0.06 |              1.6 |       0.069 |                    15 |                     59 |    0.9964 | 3.3  |        0.46 |       9.4 |         5 |
|             7.3 |               0.65 |          0    |              1.2 |       0.065 |                    15 |                     21 |    0.9946 | 3.39 |        0.47 |      10   |         7 |
|             7.8 |               0.58 |          0.02 |              2   |       0.073 |                     9 |                     18 |    0.9968 | 3.36 |        0.57 |       9.5 |         7 |
|             7.5 |               0.5  |          0.36 |              6.1 |       0.071 |                    17 |                    102 |    0.9978 | 3.35 |        0.8  |      10.5 |         5 |


Table #3
Filename: source_2.csv
Sample Rows in Markdown:
|   fixed acidity |   volatile acidity |   citric acid |   residual sugar |   chlorides |   free sulfur dioxide |   total sulfur dioxide |   density |   pH |   sulphates |   alcohol |   quality |
|----------------:|-------------------:|--------------:|-----------------:|------------:|----------------------:|-----------------------:|----------:|-----:|------------:|----------:|----------:|
|             6.7 |               0.27 |          0.26 |              2.3 |       0.043 |                    61 |                    181 |   0.99394 | 3.45 |        0.63 |      10.6 |         6 |
|             6.6 |               0.56 |          0.15 |             10   |       0.037 |                    38 |                    157 |   0.99642 | 3.28 |        0.52 |       9.4 |         5 |
|             6.6 |               0.56 |          0.15 |             10   |       0.037 |                    38 |                    157 |   0.99642 | 3.28 |        0.52 |       9.4 |         5 |
|             7.3 |               0.19 |          0.27 |              1.6 |       0.027 |                    35 |                    136 |   0.99248 | 3.38 |        0.54 |      11   |         7 |
|             6.3 |               0.2  |          0.26 |              1.6 |       0.027 |                    36 |                    141 |   0.99268 | 3.53 |        0.56 |      10.8 |         6 |
|             7.1 |               0.29 |          0.3  |             16   |       0.036 |                    58 |                    201 |   0.99954 | 3.3  |        0.67 |       9   |         5 |
|             7.8 |               0.32 |          0.33 |             10.4 |       0.031 |                    47 |                    194 |   0.99692 | 3.07 |        0.58 |       9.6 |         6 |
|             8.1 |               0.33 |          0.36 |              7.4 |       0.037 |                    36 |                    156 |   0.99592 | 3.19 |        0.54 |      10.6 |         6 |
|             8.1 |               0.33 |          0.36 |              7.4 |       0.037 |                    36 |                    156 |   0.99592 | 3.19 |        0.54 |      10.6 |         6 |
|             7.8 |               0.32 |          0.33 |             10.4 |       0.031 |                    47 |                    194 |   0.99692 | 3.07 |        0.58 |       9.6 |         6 |


Target Schema:
|   fixed acidity |   volatile acidity |   citric acid |   residual sugar |   chlorides |   free sulfur dioxide |   total sulfur dioxide |   density |   pH |   sulphates |   alcohol |   quality |
|----------------:|-------------------:|--------------:|-----------------:|------------:|----------------------:|-----------------------:|----------:|-----:|------------:|----------:|----------:|
|             7.4 |               0.7  |          0    |              1.9 |       0.076 |                    11 |                     34 |    0.9978 | 3.51 |        0.56 |       9.4 |         5 |
|             7.8 |               0.88 |          0    |              2.6 |       0.098 |                    25 |                     67 |    0.9968 | 3.2  |        0.68 |       9.8 |         5 |
|             7.8 |               0.76 |          0.04 |              2.3 |       0.092 |                    15 |                     54 |    0.997  | 3.26 |        0.65 |       9.8 |         5 |
|            11.2 |               0.28 |          0.56 |              1.9 |       0.075 |                    17 |                     60 |    0.998  | 3.16 |        0.58 |       9.8 |         6 |
|             7.4 |               0.7  |          0    |              1.9 |       0.076 |                    11 |                     34 |    0.9978 | 3.51 |        0.56 |       9.4 |         5 |
|             7.4 |               0.66 |          0    |              1.8 |       0.075 |                    13 |                     40 |    0.9978 | 3.51 |        0.56 |       9.4 |         5 |
|             7.9 |               0.6  |          0.06 |              1.6 |       0.069 |                    15 |                     59 |    0.9964 | 3.3  |        0.46 |       9.4 |         5 |
|             7.3 |               0.65 |          0    |              1.2 |       0.065 |                    15 |                     21 |    0.9946 | 3.39 |        0.47 |      10   |         7 |
|             7.8 |               0.58 |          0.02 |              2   |       0.073 |                     9 |                     18 |    0.9968 | 3.36 |        0.57 |       9.5 |         7 |
|             7.5 |               0.5  |          0.36 |              6.1 |       0.071 |                    17 |                    102 |    0.9978 | 3.35 |        0.8  |      10.5 |         5 |

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
test: test_0.csv
test_1.csv
test_2.csv