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:
|   Rank | Name              | Team   | Position   |   Played |   SnapsPlayed |   SnapsPerGame |   SnapsPlayedPercentage |   RushSnapPercentage |   TargetSnapPercentage |   TouchSnapPercentage |   IntendedTouchSnapPercentage |   FantasyPoints |   FantasyPointSnapPercentage |
|-------:|:------------------|:-------|:-----------|---------:|--------------:|---------------:|------------------------:|---------------------:|-----------------------:|----------------------:|------------------------------:|----------------:|-----------------------------:|
|      1 | Karlos Williams   | BUF    | RB         |       11 |           243 |           22.1 |                   22.6  |                38.29 |                   5.8  |                  42.8 |                          44   |          113.3  |                        46.6  |
|      2 | Joseph Randle     | DAL    | RB         |        6 |           145 |           24.2 |                   30.5  |                52.4  |                   6.9  |                  59.3 |                          59.3 |           64.09 |                        44.2  |
|      3 | David Johnson     | ARI    | RB         |       16 |           413 |           25.8 |                   37.4  |                30.3  |                  13.8  |                  39   |                          44.1 |          173.8  |                        42.1  |
|      4 | Todd Gurley       | LAR    | RB         |       13 |           456 |           35.1 |                   47.4  |                50.2  |                   5.7  |                  54.8 |                          55.9 |          187.4  |                        41.1  |
|      5 | Thomas Rawls      | SEA    | RB         |       13 |           289 |           22.2 |                   33.29 |                50.9  |                   3.8  |                  54   |                          54.7 |          118.6  |                        41    |
|      6 | Mike Gillislee    | BUF    | RB         |        5 |           112 |           22.4 |                   32.9  |                42    |                   6.2  |                  47.3 |                          48.2 |           45.6  |                        40.7  |
|      7 | Tim Hightower     | NO     | RB         |        8 |           192 |           24   |                   34.5  |                50    |                   6.8  |                  56.2 |                          56.8 |           74.4  |                        38.79 |
|      8 | LeGarrette Blount | NE     | RB         |       12 |           309 |           25.8 |                   35.29 |                53.4  |                   2.29 |                  55.3 |                          55.7 |          116.6  |                        37.7  |
|      9 | Adrian Peterson   | MIN    | RB         |       16 |           666 |           41.6 |                   65.09 |                49.1  |                   5.4  |                  53.6 |                          54.5 |          230.7  |                        34.6  |
|     10 | Jeremy Hill       | CIN    | RB         |       16 |           459 |           28.7 |                   43.3  |                48.6  |                   4.09 |                  51.9 |                          52.7 |          155.3  |                        33.79 |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
|   Rank | Name           | Team   | Position   |   Played |   SnapsPlayed |   SnapsPerGame |   SnapsPlayedPercentage |   RushSnapPercentage |   TargetSnapPercentage |   TouchSnapPercentage |   IntendedTouchSnapPercentage |   FantasyPoints |   FantasyPointSnapPercentage |
|-------:|:---------------|:-------|:-----------|---------:|--------------:|---------------:|------------------------:|---------------------:|-----------------------:|----------------------:|------------------------------:|----------------:|-----------------------------:|
|      1 | Arian Foster   | HOU    | RB         |       13 |           621 |           47.8 |                   56    |                41.9  |                   9.5  |                 48.1  |                         51.5  |           235.5 |                        37.9  |
|      2 | Marshawn Lynch | SEA    | RB         |       16 |           704 |           44   |                   66.59 |                39.79 |                   6.8  |                 45    |                         46.6  |           265.3 |                        37.7  |
|      3 | DeMarco Murray | DAL    | RB         |       16 |           783 |           48.9 |                   73.9  |                50.2  |                   8.19 |                 57.5  |                         58.4  |           294.1 |                        37.6  |
|      4 | Jeremy Hill    | CIN    | RB         |       16 |           501 |           31.3 |                   47.2  |                44.3  |                   6.4  |                 49.7  |                         50.7  |           183.9 |                        36.7  |
|      5 | CJ Anderson    | DEN    | RB         |       15 |           495 |           33   |                   43.9  |                36.2  |                   8.9  |                 43    |                         45.1  |           177.3 |                        35.79 |
|      6 | Ryan Mathews   | LAC    | RB         |        6 |           165 |           27.5 |                   15.4  |                44.8  |                   6.1  |                 50.3  |                         50.9  |            57.9 |                        35.1  |
|      7 | Mark Ingram    | NO     | RB         |       13 |           470 |           36.2 |                   41.2  |                48.1  |                   7.7  |                 54.3  |                         55.7  |           162.9 |                        34.7  |
|      8 | Eddie Lacy     | GB     | RB         |       16 |           687 |           42.9 |                   65.4  |                35.79 |                   8    |                 41.9  |                         43.8  |           230.6 |                        33.6  |
|      9 | Jamaal Charles | KC     | RB         |       15 |           650 |           43.3 |                   64.5  |                31.7  |                   9.1  |                 37.79 |                         40.79 |           210.4 |                        32.4  |
|      9 | Tre Mason      | LAR    | RB         |       12 |           368 |           30.7 |                   36.7  |                48.6  |                   7.1  |                 53    |                         55.7  |           119.3 |                        32.4  |


Table #3
Filename: source_2.csv
Sample Rows in Markdown:
|   Rank | Name            | Team   | Position   |   Played |   SnapsPlayed |   SnapsPerGame |   SnapsPlayedPercentage |   RushSnapPercentage |   TargetSnapPercentage |   TouchSnapPercentage |   IntendedTouchSnapPercentage |   FantasyPoints |   FantasyPointSnapPercentage |
|-------:|:----------------|:-------|:-----------|---------:|--------------:|---------------:|------------------------:|---------------------:|-----------------------:|----------------------:|------------------------------:|----------------:|-----------------------------:|
|      1 | Andre Brown     | NYG    | RB         |       10 |           226 |           22.6 |                    31.1 |                32.29 |                    7.5 |                  37.6 |                         39.79 |           97.1  |                        43    |
|      2 | Adrian Peterson | MIN    | RB         |       16 |           771 |           48.2 |                    74.5 |                45.1  |                    6.6 |                  50.3 |                         51.8  |          307.39 |                        39.9  |
|      3 | CJ Spiller      | BUF    | RB         |       16 |           569 |           35.6 |                    56.3 |                36.4  |                   10   |                  43.9 |                         46.4  |          212.3  |                        37.29 |
|      4 | Marshawn Lynch  | SEA    | RB         |       16 |           674 |           42.1 |                    66.3 |                46.7  |                    4.5 |                  50.1 |                         51.2  |          246.6  |                        36.6  |
|      5 | Stevan Ridley   | NE     | RB         |       16 |           550 |           34.4 |                    44.4 |                52.7  |                    2.5 |                  53.8 |                         55.3  |          199.4  |                        36.29 |
|      6 | Jamaal Charles  | KC     | RB         |       16 |           577 |           36.1 |                    54.8 |                49.4  |                    8.3 |                  55.5 |                         57.7  |          204.5  |                        35.4  |
|      7 | Alfred Morris   | WAS    | RB         |       16 |           727 |           45.4 |                    70.4 |                46.1  |                    2.2 |                  47.6 |                         48.3  |          241    |                        33.1  |
|      8 | Michael Turner  | ATL    | RB         |       16 |           476 |           29.8 |                    44.9 |                46.6  |                    6.3 |                  50.6 |                         52.9  |          156.8  |                        32.9  |
|      9 | Doug Martin     | TB     | RB         |       16 |           821 |           51.3 |                    78.3 |                38.9  |                    8.5 |                  44.8 |                         47.4  |          262.6  |                        32    |
|     10 | Darren Sproles  | NO     | RB         |       13 |           444 |           34.2 |                    40.1 |                10.8  |                   23.4 |                  27.7 |                         34.2  |          141.1  |                        31.8  |


Table #4
Filename: source_3.csv
Sample Rows in Markdown:
|   Rank | Name              | Team   | Position   |   Played |   SnapsPlayed |   SnapsPerGame |   SnapsPlayedPercentage |   RushSnapPercentage |   TargetSnapPercentage |   TouchSnapPercentage |   IntendedTouchSnapPercentage |   FantasyPoints |   FantasyPointSnapPercentage |
|-------:|:------------------|:-------|:-----------|---------:|--------------:|---------------:|------------------------:|---------------------:|-----------------------:|----------------------:|------------------------------:|----------------:|-----------------------------:|
|      1 | Alvin Kamara      | NO     | RB         |       16 |           464 |          29    |                    44.7 |                25.9  |                   21.6 |                  43.3 |                         47.4  |           233.4 |                        50.3  |
|      2 | Dion Lewis        | NE     | RB         |       16 |           404 |          25.2  |                    35.4 |                44.6  |                    8.9 |                  52.5 |                         53.5  |           165   |                        40.79 |
|      3 | Todd Gurley       | LAR    | RB         |       15 |           796 |          53.1  |                    76.5 |                35.1  |                   10.9 |                  43.1 |                         46    |           319.3 |                        40.1  |
|      4 | Alex Collins      | BAL    | RB         |       15 |           378 |          25.2  |                    37.1 |                56.1  |                    9.5 |                  62.2 |                         65.59 |           148   |                        39.2  |
|      5 | Mark Ingram       | NO     | RB         |       16 |           570 |          35.6  |                    54.9 |                40.4  |                   12.5 |                  50.5 |                         52.8  |           220   |                        38.6  |
|      6 | Orleans Darkwa    | NYG    | RB         |       15 |           315 |          21    |                    29.1 |                54.3  |                    8.9 |                  60.3 |                         63.2  |           118.7 |                        37.7  |
|      7 | Kareem Hunt       | KC     | RB         |       16 |           670 |          41.9  |                    64.9 |                40.6  |                    9.4 |                  48.5 |                         50    |           242.2 |                        36.1  |
|      8 | Leonard Fournette | JAX    | RB         |       13 |           564 |          43.4  |                    49.8 |                47.5  |                    8.5 |                  53.9 |                         56    |           194.2 |                        34.4  |
|      9 | Latavius Murray   | MIN    | RB         |       16 |           421 |          26.3  |                    37.7 |                51.3  |                    4   |                  54.9 |                         55.3  |           142.5 |                        33.79 |
|     10 | Chris Thompson    | WAS    | RB         |       10 |           338 |          33.79 |                    46.5 |                18.89 |                   16   |                  30.5 |                         34.9  |           112.4 |                        33.29 |


Table #5
Filename: source_4.csv
Sample Rows in Markdown:
|   Rank | Name               | Team   | Position   |   Played |   SnapsPlayed |   SnapsPerGame |   SnapsPlayedPercentage |   RushSnapPercentage |   TargetSnapPercentage |   TouchSnapPercentage |   IntendedTouchSnapPercentage |   FantasyPoints |   FantasyPointSnapPercentage |
|-------:|:-------------------|:-------|:-----------|---------:|--------------:|---------------:|------------------------:|---------------------:|-----------------------:|----------------------:|------------------------------:|----------------:|-----------------------------:|
|     37 | Darren McFadden    | OAK    | RB         |       10 |           336 |           33.6 |                   32.4  |                33.9  |                   7.4  |                 39.29 |                          41.7 |           81.34 |                        24.2  |
|     38 | Pierre Thomas      | NO     | RB         |       16 |           564 |           35.2 |                   50    |                26.1  |                  14.9  |                 39.7  |                          41   |          134.19 |                        23.8  |
|     38 | Daniel Thomas      | MIA    | RB         |       15 |           348 |           23.2 |                   33.9  |                31.3  |                   4.9  |                 35.6  |                          36.2 |           82.9  |                        23.8  |
|     40 | Frank Gore         | SF     | RB         |       16 |           744 |           46.5 |                   75.09 |                37.1  |                   3.5  |                 39.2  |                          40.6 |          174.9  |                        23.5  |
|     41 | Ben Tate           | HOU    | RB         |       14 |           481 |           34.4 |                   48.3  |                37.6  |                  10.19 |                 44.7  |                          47.8 |          111.1  |                        23.1  |
|     42 | Brandon Bolden     | NE     | RB         |       12 |           269 |           22.4 |                   22.5  |                20.39 |                  10.8  |                 28.3  |                          31.2 |           60.3  |                        22.4  |
|     43 | Maurice Jones-Drew | JAX    | RB         |       15 |           647 |           43.1 |                   61.2  |                36.2  |                   9.3  |                 43    |                          45.6 |          144.02 |                        22.3  |
|     44 | Peyton Hillis      | NYG    | RB         |        7 |           202 |           28.9 |                   26.4  |                36.1  |                  10.4  |                 42.6  |                          46.5 |           44.3  |                        21.9  |
|     45 | Jacquizz Rodgers   | ATL    | RB         |       15 |           435 |           29   |                   40.4  |                22.3  |                  14.3  |                 34.29 |                          36.6 |           89.4  |                        20.6  |
|     46 | Andre Brown        | NYG    | RB         |        8 |           360 |           45   |                   72.4  |                38.6  |                   8.1  |                 44.2  |                          46.7 |           73.5  |                        20.39 |


Table #6
Filename: source_5.csv
Sample Rows in Markdown:
|   Rank | Name            | Team   | Position   |   Played |   SnapsPlayed |   SnapsPerGame |   SnapsPlayedPercentage |   RushSnapPercentage |   TargetSnapPercentage |   TouchSnapPercentage |   IntendedTouchSnapPercentage |   FantasyPoints |   FantasyPointSnapPercentage |
|-------:|:----------------|:-------|:-----------|---------:|--------------:|---------------:|------------------------:|---------------------:|-----------------------:|----------------------:|------------------------------:|----------------:|-----------------------------:|
|      1 | Mark Ingram     | NO     | RB         |        1 |            36 |           36   |                   54.5  |                 44.4 |                    8.3 |                 50    |                         52.8  |            19.3 |                         53.6 |
|      2 | Isaiah Crowell  | NYJ    | RB         |        6 |           158 |           26.3 |                   42    |                 44.3 |                    6.3 |                 49.4  |                         50.6  |            77.8 |                         49.2 |
|      3 | Melvin Gordon   | LAC    | RB         |        6 |           270 |           45   |                   70.5  |                 33.7 |                   15.6 |                 44.8  |                         49.3  |           132.5 |                         49.1 |
|      3 | Sony Michel     | NE     | RB         |        5 |           134 |           26.8 |                   39.79 |                 67.9 |                    5.2 |                 70.09 |                         73.09 |            65.8 |                         49.1 |
|      5 | Austin Ekeler   | LAC    | RB         |        6 |           131 |           21.8 |                   34.2  |                 31.3 |                   13   |                 42    |                         44.3  |            63   |                         48.1 |
|      6 | Kenneth Dixon   | BAL    | RB         |        1 |            22 |           22   |                   27.5  |                 59.1 |                    0   |                 59.1  |                         59.1  |            10.4 |                         47.3 |
|      7 | Todd Gurley     | LAR    | RB         |        6 |           349 |           58.2 |                   85.7  |                 37   |                    8.6 |                 43    |                         45.6  |           155   |                         44.4 |
|      8 | Matt Breida     | SF     | RB         |        6 |           163 |           27.2 |                   39.5  |                 38.7 |                    8   |                 45.4  |                         46.6  |            70   |                         42.9 |
|      9 | Adrian Peterson | WAS    | RB         |        5 |           149 |           29.8 |                   43.2  |                 51.7 |                    6.7 |                 56.4  |                         58.4  |            63.5 |                         42.6 |
|     10 | Phillip Lindsay | DEN    | RB         |        7 |           173 |           24.7 |                   36.79 |                 43.4 |                   11.6 |                 52    |                         54.9  |            73.5 |                         42.5 |


Table #7
Filename: source_6.csv
Sample Rows in Markdown:
|   Rank | Name              | Team   | Position   |   Played |   SnapsPlayed |   SnapsPerGame |   SnapsPlayedPercentage |   RushSnapPercentage |   TargetSnapPercentage |   TouchSnapPercentage |   IntendedTouchSnapPercentage |   FantasyPoints |   FantasyPointSnapPercentage |
|-------:|:------------------|:-------|:-----------|---------:|--------------:|---------------:|------------------------:|---------------------:|-----------------------:|----------------------:|------------------------------:|----------------:|-----------------------------:|
|      1 | Ryan Mathews      | PHI    | RB         |       13 |           287 |          22.1  |                   25.3  |                54    |                    4.9 |                  58.5 |                          58.9 |          131.6  |                         45.9 |
|      2 | Tevin Coleman     | ATL    | RB         |       13 |           353 |          27.2  |                   33.9  |                33.4  |                   11.3 |                  42.2 |                          44.8 |          160.1  |                         45.4 |
|      3 | LeGarrette Blount | NE     | RB         |       16 |           529 |          33.1  |                   47.2  |                56.5  |                    1.5 |                  57.8 |                          58   |          225.9  |                         42.7 |
|      4 | Ezekiel Elliott   | DAL    | RB         |       15 |           716 |          47.7  |                   67.5  |                45    |                    5.6 |                  49.4 |                          50.6 |          293.39 |                         41   |
|      5 | LeSean McCoy      | BUF    | RB         |       15 |           645 |          43    |                   60.6  |                36.29 |                    9   |                  44.2 |                          45.3 |          248.3  |                         38.5 |
|      6 | Danny Woodhead    | LAC    | RB         |        2 |            55 |          27.5  |                    5.09 |                34.5  |                   14.5 |                  45.5 |                          49.1 |           21.1  |                         38.4 |
|      7 | Ameer Abdullah    | DET    | RB         |        2 |            57 |          28.5  |                    5.5  |                31.6  |                    8.8 |                  40.4 |                          40.4 |           21.8  |                         38.2 |
|      8 | Devonta Freeman   | ATL    | RB         |       16 |           605 |          37.79 |                   58.2  |                37.5  |                   10.7 |                  46.4 |                          48.3 |          230.1  |                         38   |
|      9 | Mark Ingram       | NO     | RB         |       16 |           530 |          33.1  |                   46    |                38.7  |                   10.9 |                  47.4 |                          49.6 |          196.2  |                         37   |
|     10 | Jeremy Hill       | CIN    | RB         |       15 |           443 |          29.5  |                   40.79 |                50.1  |                    6.1 |                  54.9 |                          56.2 |          155.3  |                         35.1 |


Target Schema:
| Name            |   Rank |   Team |   Position |   Played |   SnapsPlayed |   SnapsPerGame |   SnapsPlayedPercentage |   RushSnapPercentage |   TargetSnapPercentage |   TouchSnapPercentage |   IntendedTouchSnapPercentage |   FantasyPoints |   FantasyPointSnapPercentage |
|:----------------|-------:|-------:|-----------:|---------:|--------------:|---------------:|------------------------:|---------------------:|-----------------------:|----------------------:|------------------------------:|----------------:|-----------------------------:|
| Aaron Jones     |      1 |      1 |          1 |        1 |             1 |              1 |                       1 |                    1 |                      1 |                     1 |                             1 |               1 |                            1 |
| Adrian Peterson |      7 |      7 |          7 |        7 |             7 |              7 |                       7 |                    7 |                      7 |                     7 |                             7 |               7 |                            7 |
| Ahmad Bradshaw  |      4 |      4 |          4 |        4 |             4 |              4 |                       4 |                    4 |                      4 |                     4 |                             4 |               4 |                            4 |
| Alex Collins    |      2 |      2 |          2 |        2 |             2 |              2 |                       2 |                    2 |                      2 |                     2 |                             2 |               2 |                            2 |
| Alex Green      |      1 |      1 |          1 |        1 |             1 |              1 |                       1 |                    1 |                      1 |                     1 |                             1 |               1 |                            1 |
| Alfred Blue     |      3 |      3 |          3 |        3 |             3 |              3 |                       3 |                    3 |                      3 |                     3 |                             3 |               3 |                            3 |
| Alfred Morris   |      5 |      5 |          5 |        5 |             5 |              5 |                       5 |                    5 |                      5 |                     5 |                             5 |               5 |                            5 |
| Alvin Kamara    |      2 |      2 |          2 |        2 |             2 |              2 |                       2 |                    2 |                      2 |                     2 |                             2 |               2 |                            2 |
| Ameer Abdullah  |      3 |      3 |          3 |        3 |             3 |              3 |                       3 |                    3 |                      3 |                     3 |                             3 |               3 |                            3 |
| Andre Brown     |      1 |      1 |          1 |        1 |             1 |              1 |                       1 |                    1 |                      1 |                     1 |                             1 |               1 |                            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
source_2.csv
source_3.csv
source_4.csv
source_5.csv
source_6.csv
test: test_0.csv
test_1.csv
test_2.csv
test_3.csv
test_4.csv
test_5.csv
test_6.csv