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:
|   match_event_id |   location_x | location_y   |   remaining_min |   power_of_shot | knockout_match   | game_season   | remaining_sec   |   distance_of_shot | is_goal   | area_of_shot          | shot_basics   | range_of_shot   | team_name         | date_of_game   |   home/away |   shot_id_number | lat/lng               | type_of_shot   | type_of_combined_shot   |   match_id |    team_id |   remaining_min.1 | power_of_shot.1   |   knockout_match.1 |   remaining_sec.1 |   distance_of_shot.1 |
|-----------------:|-------------:|:-------------|----------------:|----------------:|:-----------------|:--------------|:----------------|-------------------:|:----------|:----------------------|:--------------|:----------------|:------------------|:---------------|------------:|-----------------:|:----------------------|:---------------|:------------------------|-----------:|-----------:|------------------:|:------------------|-------------------:|------------------:|---------------------:|
|               64 |          103 | 184.0        |               4 |               1 | 0.0              | 2009-10       | 31.0            |                 41 |           | Right Side Center(RC) | Mid Range     | 16-24 ft.       | Manchester United | 15-12-2009     |           1 |            15349 | 41.845137, -87.660450 | shot - 31      |                         |   20900354 | 1610612747 |                 4 | 1.0               |              0     |              31   |                 41   |
|               66 |          166 |              |               4 |               1 | 0.0              | 2009-10       | 5.0             |                 38 | 1.0       | Right Side(R)         |               | 16-24 ft.       | Manchester United | 15-12-2009     |           1 |            15350 | 41.845137, -87.660450 |                | shot - 3                |   20900354 | 1610612747 |                 4 | 60.36             |              0     |               5   |                 38   |
|               72 |          171 | 12.0         |               3 |               1 |                  | 2009-10       | 46.0            |                 37 | 1.0       | Right Side(R)         | Mid Range     | 16-24 ft.       | Manchester United | 15-12-2009     |           1 |            15351 | 41.845137, -87.660450 | shot - 38      |                         |   20900354 | 1610612747 |                 3 | 1.0               |              0     |              46   |                 37   |
|               80 |          154 | 85.0         |               2 |               1 | 0.0              | 2009-10       | 57.0            |                 37 | 1.0       | Right Side(R)         | Mid Range     | 16-24 ft.       |                   | 15-12-2009     |           1 |            15352 | 41.845137, -87.660450 |                | shot - 3                |   20900354 | 1610612747 |                 2 | 85.36             |              0     |              57   |                 37   |
|               82 |         -172 | 74.0         |               2 |               1 | 0.0              | 2009-10       | 24.0            |                 38 | 1.0       | Left Side(L)          | Mid Range     | 16-24 ft.       | Manchester United | 15-12-2009     |           1 |            15353 | 41.845137, -87.660450 |                | shot - 3                |   20900354 | 1610612747 |                 2 | 1.0               |              0     |              24   |                 38   |
|               88 |          171 | 186.0        |               1 |               1 | 0.0              | 2009-10       | 45.0            |                 45 |           | Right Side Center(RC) | Penalty Spot  | 24+ ft.         | Manchester United | 15-12-2009     |           1 |            15354 | 41.845137, -87.660450 |                | shot - 3                |   20900354 | 1610612747 |                 1 | 117.36            |              0     |              45   |                 94.4 |
|               92 |         -175 | 39.0         |               1 |               1 | 0.0              | 2009-10       | 12.0            |                 37 | 0.0       | Left Side(L)          | Mid Range     | 16-24 ft.       | Manchester United | 15-12-2009     |           1 |            15355 |                       |                | shot - 3                |   20900354 | 1610612747 |                 1 | 106.36            |              0     |              12   |                 66.4 |
|              176 |          -51 | 101.0        |               5 |               2 | 0.0              | 2009-10       | 34.0            |                 31 | 1.0       | Center(C)             | Goal Line     | 8-16 ft.        | Manchester United | 15-12-2009     |           1 |            15356 | 41.845137, -87.660450 | shot - 43      |                         |   20900354 | 1610612747 |                 5 | 2.0               |             42.608 |              34   |                 31   |
|              202 |           39 | 132.0        |               1 |               2 | 0.0              |               | 53.0            |                 33 | 1.0       | Center(C)             | Goal Line     | 8-16 ft.        | Manchester United | 15-12-2009     |           1 |            15357 | 41.845137, -87.660450 | shot - 33      |                         |   20900354 | 1610612747 |                 1 |                   |              0     |              53   |                 33   |
|              207 |          182 | 181.0        |               1 |               2 | 0.0              | 2009-10       |                 |                 45 | 0.0       | Right Side Center(RC) | Penalty Spot  | 24+ ft.         | Manchester United |                |           1 |            15358 | 41.845137, -87.660450 | shot - 36      |                         |   20900354 | 1610612747 |                 1 | 2.0               |              0     |              83.2 |                 45   |


Target Schema:
| type_of_combined_shot   | is_goal   |   shot_sum |   is_goal_count1 |
|:------------------------|:----------|-----------:|-----------------:|
| shot - 3                | 0.0       |       1828 |             4591 |
| shot - 3                |           |       1828 |             4591 |
| shot - 3                | 1.0       |       1828 |             4591 |
| shot - 3                | 0.0       |       1828 |             4591 |
| shot - 3                | 0.0       |       1828 |             4591 |
| shot - 3                | 0.0       |       1828 |             4591 |
| shot - 3                | 1.0       |       1828 |             4591 |
| shot - 3                | 1.0       |       1828 |             4591 |
| shot - 3                | 0.0       |       1828 |             4591 |
| shot - 3                | 0.0       |       1828 |             4591 |

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