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:
| batsman      |   batsman_runs |
|:-------------|---------------:|
| S Curran     |        11.875  |
| AD Nath      |        11.8333 |
| S Rutherford |        11.7143 |
| STR Binny    |        11.6    |
| H Klaasen    |        11.3333 |
| DJ Hooda     |        10.8    |
| R Ashwin     |        10.7857 |
| S Gopal      |        10.6364 |
| R Singh      |        10.4286 |
| I Sharma     |        10      |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
| batsman       |   batsman_runs |
|:--------------|---------------:|
| KL Rahul      |             17 |
| RR Pant       |             16 |
| S Dhawan      |             15 |
| KS Williamson |             15 |
| AS Yadav      |             15 |
| SS Iyer       |             14 |
| V Kohli       |             14 |
| CA Lynn       |             14 |
| MS Dhoni      |             13 |
| SK Raina      |             13 |


Table #3
Filename: source_2.csv
Sample Rows in Markdown:
| batsman        |   total_runs |
|:---------------|-------------:|
| AD Russell     |           82 |
| RR Pant        |           65 |
| CH Gayle       |           61 |
| KL Rahul       |           57 |
| AB de Villiers |           56 |
| SR Watson      |           56 |
| MS Dhoni       |           51 |
| AT Rayudu      |           41 |
| HH Pandya      |           41 |
| CA Lynn        |           40 |


Table #4
Filename: source_3.csv
Sample Rows in Markdown:
| batsman        |   batsman_runs |
|:---------------|---------------:|
| KL Rahul       |             13 |
| AB de Villiers |             11 |
| RR Pant        |              9 |
| S Dhawan       |              9 |
| DA Warner      |              9 |
| CH Gayle       |              8 |
| JC Buttler     |              8 |
| KS Williamson  |              8 |
| V Kohli        |              8 |
| SR Watson      |              7 |


Table #5
Filename: source_4.csv
Sample Rows in Markdown:
| batsman        |   no of balls |   batsman_runs |   strike |
|:---------------|--------------:|---------------:|---------:|
| A Dananjaya    |             5 |              4 |  80      |
| A Hales        |           119 |            152 | 127.731  |
| A Joseph       |            13 |             15 | 115.385  |
| A Mishra       |            28 |             28 | 100      |
| A Turner       |            11 |              4 |  36.3636 |
| AB de Villiers |           575 |            942 | 163.826  |
| AD Nath        |            71 |             71 | 100      |
| AD Russell     |           453 |            871 | 192.274  |
| AJ Finch       |           102 |            140 | 137.255  |
| AJ Tye         |            42 |             41 |  97.619  |


Table #6
Filename: source_5.csv
Sample Rows in Markdown:
| batsman    |   batsman_runs |
|:-----------|---------------:|
| CH Gayle   |              2 |
| SR Watson  |              2 |
| KL Rahul   |              2 |
| RR Pant    |              1 |
| AM Rahane  |              1 |
| P Shaw     |              1 |
| KD Karthik |              1 |
| SV Samson  |              1 |
| J Bairstow |              1 |
| DA Warner  |              1 |


Table #7
Filename: source_6.csv
Sample Rows in Markdown:
| batsman    |   total_runs |
|:-----------|-------------:|
| S Dhawan   |          125 |
| KL Rahul   |          116 |
| AS Yadav   |          106 |
| RR Pant    |          104 |
| V Kohli    |           98 |
| CA Lynn    |           96 |
| SK Raina   |           91 |
| JC Buttler |           91 |
| SR Watson  |           86 |
| AM Rahane  |           85 |


Target Schema:
| batsman         |   batsman_runs_x |   total_runs_x |   total_runs_y |   batsman_runs_y |   batsman_runs_x_5 |   no of balls |   batsman_runs_y_7 |   strike |   batsman_runs |
|:----------------|-----------------:|---------------:|---------------:|-----------------:|-------------------:|--------------:|-------------------:|---------:|---------------:|
| DA Warner       |          60.5833 |             58 |             22 |                9 |                  1 |           496 |                727 |  146.573 |             10 |
| J Bairstow      |          46.8    |             50 |             18 |                4 |                  1 |           293 |                468 |  159.727 |              7 |
| KL Rahul        |          46      |            116 |             57 |               13 |                  2 |           873 |               1288 |  147.537 |             17 |
| JC Buttler      |          43      |             91 |             36 |                8 |                  0 |           579 |                903 |  155.959 |             11 |
| RR Pant         |          40.9333 |            104 |             65 |                9 |                  1 |           723 |               1228 |  169.848 |             16 |
| AB de Villiers  |          39.25   |             70 |             56 |               11 |                  0 |           575 |                942 |  163.826 |             12 |
| CH Gayle        |          37.875  |             77 |             61 |                8 |                  2 |           599 |                909 |  151.753 |             11 |
| V Kohli         |          36.1071 |             98 |             31 |                8 |                  1 |           717 |               1011 |  141.004 |             14 |
| KS Williamson   |          34.9231 |             77 |             33 |                8 |                  0 |           656 |                908 |  138.415 |             15 |
| Gurkeerat Singh |          34.6667 |             11 |              2 |                1 |                  0 |            73 |                104 |  142.466 |              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