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:
|   Id |   SalePrice |
|-----:|------------:|
| 1461 |      119593 |
| 1462 |      154097 |
| 1463 |      174475 |
| 1464 |      191951 |
| 1465 |      188765 |
| 1466 |      178957 |
| 1467 |      168544 |
| 1468 |      174360 |
| 1469 |      182345 |
| 1470 |      130195 |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
|   Id |   SalePrice |
|-----:|------------:|
| 1461 |      117072 |
| 1462 |      153884 |
| 1463 |      186418 |
| 1464 |      198805 |
| 1465 |      200394 |
| 1466 |      173914 |
| 1467 |      179265 |
| 1468 |      161935 |
| 1469 |      195571 |
| 1470 |      119666 |


Table #3
Filename: source_2.csv
Sample Rows in Markdown:
|   Id |   SalePrice |
|-----:|------------:|
| 1461 |      117363 |
| 1462 |      153029 |
| 1463 |      188142 |
| 1464 |      197930 |
| 1465 |      198192 |
| 1466 |      173661 |
| 1467 |      176389 |
| 1468 |      163089 |
| 1469 |      190230 |
| 1470 |      119151 |


Table #4
Filename: source_3.csv
Sample Rows in Markdown:
|   Id |   SalePrice |
|-----:|------------:|
| 1461 |      123556 |
| 1462 |      164023 |
| 1463 |      187372 |
| 1464 |      189894 |
| 1465 |      187423 |
| 1466 |      173930 |
| 1467 |      176140 |
| 1468 |      164652 |
| 1469 |      182654 |
| 1470 |      124527 |


Table #5
Filename: source_4.csv
Sample Rows in Markdown:
|   Id |   SalePrice |
|-----:|------------:|
| 1461 |      115719 |
| 1462 |      154401 |
| 1463 |      180313 |
| 1464 |      195571 |
| 1465 |      200001 |
| 1466 |      173358 |
| 1467 |      180551 |
| 1468 |      164558 |
| 1469 |      198215 |
| 1470 |      116325 |


Table #6
Filename: source_5.csv
Sample Rows in Markdown:
|   Id |   SalePrice |
|-----:|------------:|
| 2190 |     84889.7 |
| 2191 |     84889.7 |
| 2192 |     84889.7 |
| 2193 |     94624.8 |
| 2194 |     94624.8 |
| 2195 |    129217   |
| 2196 |    111697   |
| 2197 |    132712   |
| 2198 |    214014   |
| 2199 |    189935   |


Table #7
Filename: source_6.csv
Sample Rows in Markdown:
|   Id |   SalePrice |
|-----:|------------:|
| 1461 |      117134 |
| 1462 |      153227 |
| 1463 |      188021 |
| 1464 |      203011 |
| 1465 |      196790 |
| 1466 |      174798 |
| 1467 |      181301 |
| 1468 |      163056 |
| 1469 |      197453 |
| 1470 |      118869 |


Table #8
Filename: source_7.csv
Sample Rows in Markdown:
|   Id |   SalePrice |
|-----:|------------:|
| 1461 |      123192 |
| 1462 |      157129 |
| 1463 |      180890 |
| 1464 |      186517 |
| 1465 |      190852 |
| 1466 |      180689 |
| 1467 |      173292 |
| 1468 |      176905 |
| 1469 |      182933 |
| 1470 |      124508 |


Target Schema:
|   Id |   SalePrice_x |   SalePrice_y |   SalePrice_x_3 |   SalePrice_y_4 |   SalePrice_x_5 |   SalePrice_y_6 |   SalePrice_x_7 |   SalePrice_y_8 |
|-----:|--------------:|--------------:|----------------:|----------------:|----------------:|----------------:|----------------:|----------------:|
| 1461 |        129217 |        117072 |          119593 |          115719 |          117134 |          123556 |          123192 |          117363 |
| 1462 |        142993 |        153884 |          154097 |          154401 |          153227 |          164023 |          157129 |          153029 |
| 1463 |        152847 |        186418 |          174475 |          180313 |          188021 |          187372 |          180890 |          188142 |
| 1464 |        189935 |        198805 |          191951 |          195571 |          203011 |          189894 |          186517 |          197930 |
| 1465 |        214014 |        200394 |          188765 |          200001 |          196790 |          187423 |          190852 |          198192 |
| 1466 |        189935 |        173914 |          178957 |          173358 |          174798 |          173930 |          180689 |          173661 |
| 1467 |        164549 |        179265 |          168544 |          180551 |          181301 |          176140 |          173292 |          176389 |
| 1468 |        164549 |        161935 |          174360 |          164558 |          163056 |          164652 |          176905 |          163089 |
| 1469 |        214014 |        195571 |          182345 |          198215 |          197453 |          182654 |          182933 |          190230 |
| 1470 |        129217 |        119666 |          130195 |          116325 |          118869 |          124527 |          124508 |          119151 |

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