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:
|   PassengerId |   Survived |   Pclass | Name                              | Sex    | Age   |   SibSp |   Parch | Ticket     |    Fare | Cabin   | Embarked   |
|--------------:|-----------:|---------:|:----------------------------------|:-------|:------|--------:|--------:|:-----------|--------:|:--------|:-----------|
|           446 |          1 |        1 | Dodge, Master. Washington         | male   | 4.0   |       0 |       2 | 33638      | 81.8583 | A34     | S          |
|           447 |          1 |        2 | Mellinger, Miss. Madeleine Violet | female | 13.0  |       0 |       1 | 250644     | 19.5    |         | S          |
|           448 |          1 |        1 | Seward, Mr. Frederic Kimber       | male   | 34.0  |       0 |       0 | 113794     | 26.55   |         | S          |
|           449 |          1 |        3 | Baclini, Miss. Marie Catherine    | female | 5.0   |       2 |       1 | 2666       | 19.2583 |         | C          |
|           450 |          1 |        1 | Peuchen, Major. Arthur Godfrey    | male   | 52.0  |       0 |       0 | 113786     | 30.5    | C104    | S          |
|           451 |          0 |        2 | West, Mr. Edwy Arthur             | male   | 36.0  |       1 |       2 | C.A. 34651 | 27.75   |         | S          |
|           452 |          0 |        3 | Hagland, Mr. Ingvald Olai Olsen   | male   |       |       1 |       0 | 65303      | 19.9667 |         | S          |
|           453 |          0 |        1 | Foreman, Mr. Benjamin Laventall   | male   | 30.0  |       0 |       0 | 113051     | 27.75   | C111    | C          |
|           454 |          1 |        1 | Goldenberg, Mr. Samuel L          | male   | 49.0  |       1 |       0 | 17453      | 89.1042 | C92     | C          |
|           455 |          0 |        3 | Peduzzi, Mr. Joseph               | male   |       |       0 |       0 | A/5 2817   |  8.05   |         | S          |


Target Schema:
|   PassengerId |   Survived |   Pclass | Name                           | Sex   | Age   |   SibSp |   Parch | Ticket    |    Fare | Cabin   | Embarked   |   Fare_x |   Fare_y |
|--------------:|-----------:|---------:|:-------------------------------|:------|:------|--------:|--------:|:----------|--------:|:--------|:-----------|---------:|---------:|
|             1 |          0 |        3 | Braund, Mr. Owen Harris        | male  | 22.0  |       1 |       0 | A/5 21171 |  7.25   |         | S          |  25.1007 |      274 |
|             5 |          0 |        3 | Allen, Mr. William Henry       | male  | 35.0  |       0 |       0 | 373450    |  8.05   |         | S          |  25.1007 |      274 |
|             6 |          0 |        3 | Moran, Mr. James               | male  |       |       0 |       0 | 330877    |  8.4583 |         | Q          |  25.1007 |      274 |
|             7 |          0 |        1 | McCarthy, Mr. Timothy J        | male  | 54.0  |       0 |       0 | 17463     | 51.8625 | E46     | S          |  25.1007 |      274 |
|             8 |          0 |        3 | Palsson, Master. Gosta Leonard | male  | 2.0   |       3 |       1 | 349909    | 21.075  |         | S          |  25.1007 |      274 |
|            13 |          0 |        3 | Saundercock, Mr. William Henry | male  | 20.0  |       0 |       0 | A/5. 2151 |  8.05   |         | S          |  25.1007 |      274 |
|            14 |          0 |        3 | Andersson, Mr. Anders Johan    | male  | 39.0  |       1 |       5 | 347082    | 31.275  |         | S          |  25.1007 |      274 |
|            17 |          0 |        3 | Rice, Master. Eugene           | male  | 2.0   |       4 |       1 | 382652    | 29.125  |         | Q          |  25.1007 |      274 |
|            18 |          1 |        2 | Williams, Mr. Charles Eugene   | male  |       |       0 |       0 | 244373    | 13      |         | S          |  25.1007 |      274 |
|            21 |          0 |        2 | Fynney, Mr. Joseph J           | male  | 35.0  |       0 |       0 | 239865    | 26      |         | S          |  25.1007 |      274 |

Return only the final code in markdown codeblock format, without any additional text or explanation. 



target: target.csv
train: source_0.csv
test: test_0.csv