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:
|   Store |   Dept | Date       |   Weekly_Sales | IsHoliday   |
|--------:|-------:|:-----------|---------------:|:------------|
|      16 |     85 | 2010-02-19 |        1557.31 | False       |
|      18 |     81 | 2010-04-23 |       11037.2  | False       |
|      29 |      3 | 2010-10-22 |        5496.29 | False       |
|      24 |     33 | 2010-09-10 |       15493.9  | True        |
|       2 |     33 | 2010-02-19 |        7981.41 | False       |
|      24 |     31 | 2011-03-18 |        2004    | False       |
|      18 |     16 | 2010-03-19 |       17322.9  | False       |
|      10 |     74 | 2011-08-19 |       48607.3  | False       |
|       4 |      5 | 2010-02-12 |       48016.9  | True        |
|      42 |      5 | 2012-04-13 |        1077.56 | False       |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
|     ID |   shop_id |   item_id |
|-------:|----------:|----------:|
|  64198 |        22 |     11723 |
| 210541 |        45 |     11775 |
|  12966 |         6 |     21760 |
|  82442 |        16 |     17945 |
|  14680 |         6 |     13341 |
| 134238 |        48 |      9513 |
|  75467 |        21 |     16077 |
|   3515 |         5 |      5460 |
| 193227 |        46 |       515 |
|  96349 |        14 |       649 |


Target Schema:
|   Store |   Dept | Date       |   Weekly_Sales | IsHoliday   | ID   | shop_id   | item_id   |
|--------:|-------:|:-----------|---------------:|:------------|:-----|:----------|:----------|
|      35 |      1 | 2010-06-04 |       15683.8  | False       |      |           |           |
|      22 |      7 | 2010-06-04 |       38291.1  | False       |      |           |           |
|      13 |     93 | 2010-04-16 |       45997.1  | False       |      |           |           |
|      14 |      4 | 2011-07-15 |       55723.6  | False       |      |           |           |
|      18 |     21 | 2011-09-09 |        4149.66 | True        |      |           |           |
|      23 |      7 | 2011-11-04 |       34615.7  | False       |      |           |           |
|      16 |     18 | 2010-10-01 |        2532.84 | False       |      |           |           |
|      17 |      9 | 2011-10-28 |       20911.6  | False       |      |           |           |
|      35 |     31 | 2012-02-17 |        2616.89 | False       |      |           |           |
|      26 |     17 | 2010-04-30 |        7026.86 | False       |      |           |           |

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