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:
| PLAYER           |   2017-18 |
|:-----------------|----------:|
| JaVale McGee     |   2116955 |
| Omri Casspi      |   2106470 |
| Kevon Looney     |   1471382 |
| Patrick McCaw    |   1312611 |
| Damian Jones     |   1312611 |
| Jason Thompson * |    945126 |
| Jordan Bell      |    815615 |
| Quinn Cook       |     14832 |
| Chris Boucher    |     75000 |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
|   # | Player           | Team   |   GP |   MPG |   FGM |   FGA |   FG% |   3PM |   3PA |   3P% |   FTM |   FTA |   FT% |   TOV |   PF |   ORB |   DRB |   RPG |   APG |   SPG |   BPG |   PPG |
|----:|:-----------------|:-------|-----:|------:|------:|------:|------:|------:|------:|------:|------:|------:|------:|------:|-----:|------:|------:|------:|------:|------:|------:|------:|
|   1 | Stephen Curry    | GSW    |   51 |  32   |   8.4 |  16.9 | 0.495 |   4.2 |   9.8 | 0.423 |   5.5 |   5.9 | 0.921 |   3   |  2.2 |   0.7 |   4.4 |   5.1 |   6.1 |   1.6 |   0.2 |  26.4 |
|   2 | Kevin Durant     | GSW    |   68 |  34.2 |   9.3 |  18   | 0.516 |   2.5 |   6.1 | 0.419 |   5.3 |   5.9 | 0.889 |   3   |  2   |   0.5 |   6.4 |   6.8 |   5.4 |   0.7 |   1.8 |  26.4 |
|   3 | Klay Thompson    | GSW    |   73 |  34.3 |   7.9 |  16.1 | 0.488 |   3.1 |   7.1 | 0.44  |   1.1 |   1.3 | 0.837 |   1.8 |  1.6 |   0.4 |   3.4 |   3.8 |   2.5 |   0.8 |   0.5 |  20   |
|   4 | Draymond Green   | GSW    |   70 |  32.7 |   4   |   8.8 | 0.454 |   1.1 |   3.7 | 0.301 |   1.9 |   2.5 | 0.775 |   2.9 |  2.6 |   1.1 |   6.6 |   7.6 |   7.3 |   1.4 |   1.3 |  11   |
|   5 | Quinn Cook       | GSW    |   33 |  22.4 |   3.7 |   7.6 | 0.484 |   1.4 |   3.2 | 0.442 |   0.7 |   0.8 | 0.88  |   1   |  1.8 |   0.3 |   2.2 |   2.5 |   2.7 |   0.4 |   0   |   9.5 |
|   6 | Nick Young       | GSW    |   80 |  17.4 |   2.5 |   6.1 | 0.412 |   1.5 |   4.1 | 0.377 |   0.7 |   0.8 | 0.862 |   0.5 |  1.2 |   0.2 |   1.3 |   1.6 |   0.5 |   0.5 |   0.1 |   7.3 |
|   7 | David West       | GSW    |   73 |  13.7 |   3   |   5.2 | 0.571 |   0   |   0.1 | 0.375 |   0.8 |   1.1 | 0.759 |   1.1 |  1.6 |   0.9 |   2.4 |   3.3 |   1.9 |   0.6 |   1   |   6.8 |
|   8 | Andre Iguodala   | GSW    |   64 |  25.4 |   2.3 |   5   | 0.463 |   0.5 |   1.8 | 0.282 |   0.9 |   1.4 | 0.632 |   1   |  1.5 |   0.8 |   3.1 |   3.8 |   3.3 |   0.8 |   0.6 |   6   |
|   9 | Omri Casspi      | GSW    |   53 |  14   |   2.3 |   3.9 | 0.58  |   0.2 |   0.4 | 0.455 |   0.9 |   1.3 | 0.725 |   0.7 |  1.3 |   0.6 |   3.2 |   3.8 |   1   |   0.3 |   0.4 |   5.7 |
|  10 | Shaun Livingston | GSW    |   71 |  15.9 |   2.4 |   4.8 | 0.501 |   0   |   0.1 | 0     |   0.7 |   0.9 | 0.82  |   0.8 |  1.6 |   0.5 |   1.4 |   1.8 |   2   |   0.5 |   0.3 |   5.5 |


Target Schema:
| PLAYER           |   2017-18 |   # | Player           | Team   |   GP |   MPG |   FGM |   FGA |   FG% |   3PM |   3PA |   3P% |   FTM |   FTA |   FT% |   TOV |   PF |   ORB |   DRB |   RPG |   APG |   SPG |   BPG |   PPG |
|:-----------------|----------:|----:|:-----------------|:-------|-----:|------:|------:|------:|------:|------:|------:|------:|------:|------:|------:|------:|-----:|------:|------:|------:|------:|------:|------:|------:|
| Stephen Curry    |  34682550 |   1 | Stephen Curry    | GSW    |   51 |  32   |   8.4 |  16.9 | 0.495 |   4.2 |   9.8 | 0.423 |   5.5 |   5.9 | 0.921 |   3   |  2.2 |   0.7 |   4.4 |   5.1 |   6.1 |   1.6 |   0.2 |  26.4 |
| Kevin Durant     |  25000000 |   2 | Kevin Durant     | GSW    |   68 |  34.2 |   9.3 |  18   | 0.516 |   2.5 |   6.1 | 0.419 |   5.3 |   5.9 | 0.889 |   3   |  2   |   0.5 |   6.4 |   6.8 |   5.4 |   0.7 |   1.8 |  26.4 |
| Klay Thompson    |  17826150 |   3 | Klay Thompson    | GSW    |   73 |  34.3 |   7.9 |  16.1 | 0.488 |   3.1 |   7.1 | 0.44  |   1.1 |   1.3 | 0.837 |   1.8 |  1.6 |   0.4 |   3.4 |   3.8 |   2.5 |   0.8 |   0.5 |  20   |
| Draymond Green   |  16400000 |   4 | Draymond Green   | GSW    |   70 |  32.7 |   4   |   8.8 | 0.454 |   1.1 |   3.7 | 0.301 |   1.9 |   2.5 | 0.775 |   2.9 |  2.6 |   1.1 |   6.6 |   7.6 |   7.3 |   1.4 |   1.3 |  11   |
| Andre Iguodala   |  14814815 |   8 | Andre Iguodala   | GSW    |   64 |  25.4 |   2.3 |   5   | 0.463 |   0.5 |   1.8 | 0.282 |   0.9 |   1.4 | 0.632 |   1   |  1.5 |   0.8 |   3.1 |   3.8 |   3.3 |   0.8 |   0.6 |   6   |
| Shaun Livingston |   7692308 |  10 | Shaun Livingston | GSW    |   71 |  15.9 |   2.4 |   4.8 | 0.501 |   0   |   0.1 | 0     |   0.7 |   0.9 | 0.82  |   0.8 |  1.6 |   0.5 |   1.4 |   1.8 |   2   |   0.5 |   0.3 |   5.5 |
| Nick Young       |   5192000 |   6 | Nick Young       | GSW    |   80 |  17.4 |   2.5 |   6.1 | 0.412 |   1.5 |   4.1 | 0.377 |   0.7 |   0.8 | 0.862 |   0.5 |  1.2 |   0.2 |   1.3 |   1.6 |   0.5 |   0.5 |   0.1 |   7.3 |
| Zaza Pachulia    |   3477600 |  11 | Zaza Pachulia    | GSW    |   69 |  14.1 |   2.2 |   3.8 | 0.564 |   0   |   0   | 0     |   1.1 |   1.3 | 0.806 |   1   |  1.8 |   1.3 |   3.4 |   4.7 |   1.6 |   0.6 |   0.2 |   5.4 |
| David West       |   2328652 |   7 | David West       | GSW    |   73 |  13.7 |   3   |   5.2 | 0.571 |   0   |   0.1 | 0.375 |   0.8 |   1.1 | 0.759 |   1.1 |  1.6 |   0.9 |   2.4 |   3.3 |   1.9 |   0.6 |   1   |   6.8 |

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