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:
| hero             |   disadvantage |   winrate |   matches |
|:-----------------|---------------:|----------:|----------:|
| Phantom Assassin |          -0.28 |     47.5  |    131082 |
| Lina             |          -0.34 |     49.68 |     95792 |
| Warlock          |          -0.39 |     44.3  |     48966 |
| Jakiro           |          -0.4  |     44.46 |    103184 |
| Pudge            |          -0.41 |     46.72 |    204037 |
| Skywrath Mage    |          -0.43 |     45.7  |     72868 |
| Witch Doctor     |          -0.44 |     46.28 |    110628 |
| Timbersaw        |          -0.47 |     50.22 |     37747 |
| Bounty Hunter    |          -0.52 |     46.48 |     65078 |
| Tidehunter       |          -0.52 |     45.33 |     52826 |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
| hero             |   disadvantage |   winrate |   matches |
|:-----------------|---------------:|----------:|----------:|
| Techies          |           4.12 |     46.46 |     52101 |
| Faceless Void    |           3.78 |     44.56 |    103751 |
| Riki             |           2.19 |     45.23 |     46801 |
| Morphling        |           1.87 |     49.54 |     57875 |
| Nature's Prophet |           1.86 |     54.34 |     65640 |
| Drow Ranger      |           1.82 |     47.64 |     73123 |
| Clinkz           |           1.75 |     43.87 |     53282 |
| Zeus             |           1.69 |     42.44 |     88346 |
| Bounty Hunter    |           1.67 |     47.67 |     53617 |
| Bloodseeker      |           1.62 |     49.21 |     48292 |


Table #3
Filename: source_2.csv
Sample Rows in Markdown:
| hero             |   disadvantage |   winrate |   matches |
|:-----------------|---------------:|----------:|----------:|
| Io               |           3.77 |     56.9  |     50434 |
| Nature's Prophet |           2.95 |     56.28 |    182556 |
| Chen             |           2.84 |     55.17 |     14097 |
| Morphling        |           2.81 |     50.83 |    183909 |
| Ursa             |           2.37 |     48.54 |    237748 |
| Windranger       |           2.18 |     47.8  |    321116 |
| Visage           |           2.16 |     53.03 |     17318 |
| Broodmother      |           2.05 |     48.31 |     36329 |
| Weaver           |           1.92 |     50.1  |    127623 |
| Riki             |           1.89 |     47.07 |    134089 |


Table #4
Filename: source_3.csv
Sample Rows in Markdown:
| hero           |   disadvantage |   winrate |   matches |
|:---------------|---------------:|----------:|----------:|
| Meepo          |           3.74 |     50.4  |     28967 |
| Chen           |           3.73 |     54.09 |     10727 |
| Visage         |           3.62 |     51.39 |     12297 |
| Broodmother    |           3.48 |     47.04 |     24088 |
| Lycan          |           3    |     54.69 |     16598 |
| Io             |           2.89 |     57.42 |     35320 |
| Naga Siren     |           2.53 |     49.59 |     30170 |
| Phantom Lancer |           1.86 |     52.39 |     80614 |
| Shadow Demon   |           1.84 |     54.44 |     37540 |
| Earth Spirit   |           1.68 |     52.64 |     55692 |


Table #5
Filename: source_4.csv
Sample Rows in Markdown:
| hero             |   disadvantage |   winrate |   matches |
|:-----------------|---------------:|----------:|----------:|
| Meepo            |          10.92 |     43.87 |     42478 |
| Io               |           5.49 |     56.01 |     38108 |
| Legion Commander |           4.92 |     47.3  |    240844 |
| Templar Assassin |           4.33 |     52.92 |     80706 |
| Troll Warlord    |           4.24 |     48.08 |    113692 |
| Phantom Assassin |           4.16 |     50.09 |    277249 |
| Broodmother      |           4.1  |     47.59 |     28606 |
| Lone Druid       |           4.06 |     46.25 |     52782 |
| Slardar          |           3.96 |     46.91 |    119573 |
| Chen             |           3.77 |     55.32 |     10918 |


Target Schema:
| hero          |   disadvantage |   winrate |   matches |
|:--------------|---------------:|----------:|----------:|
| Huskar        |           4.86 |     43    |     38998 |
| Techies       |           2.75 |     44.45 |     56784 |
| Oracle        |           2.48 |     46.72 |     26957 |
| Monkey King   |           2.4  |     46.87 |     86554 |
| Lifestealer   |           2.17 |     45.13 |     56574 |
| Morphling     |           2.14 |     45.92 |     80408 |
| Slark         |           2.04 |     43.91 |    130927 |
| Troll Warlord |           1.88 |     43.84 |     56359 |
| Juggernaut    |           1.77 |     43.1  |    169562 |
| Necrophos     |           1.62 |     41.87 |     67056 |

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