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:
| start      |   betterliving |
|:-----------|---------------:|
| 2018-04-30 |              1 |
| 2018-05-01 |              1 |
| 2018-05-02 |              1 |
| 2018-05-03 |              1 |
| 2018-05-04 |              1 |
| 2018-05-05 |              1 |
| 2018-05-06 |              1 |
| 2018-05-07 |              1 |
| 2018-05-08 |              1 |
| 2018-05-09 |              1 |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
| start      |   betterliving |
|:-----------|---------------:|
| 2018-05-22 |              1 |
| 2018-05-23 |              1 |
| 2018-05-24 |              1 |
| 2018-05-25 |              1 |
| 2018-05-26 |              1 |
| 2018-05-27 |              1 |
| 2018-05-28 |              1 |
| 2018-05-29 |              1 |
| 2018-05-30 |              1 |
| 2018-05-31 |              1 |


Table #3
Filename: source_2.csv
Sample Rows in Markdown:
| start      |   betterliving |
|:-----------|---------------:|
| 2016-04-17 |              1 |
| 2016-04-18 |              1 |
| 2016-04-19 |              1 |
| 2016-04-20 |              1 |
| 2016-04-21 |              1 |
| 2016-04-22 |              1 |
| 2016-04-23 |              1 |
| 2016-04-24 |              1 |
| 2016-04-25 |              1 |
| 2016-04-26 |              1 |


Table #4
Filename: source_3.csv
Sample Rows in Markdown:
| start      |   betterliving |
|:-----------|---------------:|
| 2018-01-06 |              1 |
| 2018-01-07 |              1 |
| 2018-01-08 |              1 |
| 2018-01-09 |              1 |
| 2018-01-10 |              1 |
| 2018-01-11 |              1 |
| 2018-01-12 |              1 |
| 2018-01-13 |              1 |
| 2018-01-14 |              1 |
| 2018-01-15 |              1 |


Table #5
Filename: source_4.csv
Sample Rows in Markdown:
| start      |   betterliving |
|:-----------|---------------:|
| 2016-12-28 |              1 |
| 2016-12-29 |              1 |
| 2016-12-30 |              1 |
| 2016-12-31 |              1 |
| 2017-01-01 |              1 |
| 2017-01-02 |              1 |
| 2017-01-03 |              1 |
| 2017-01-04 |              1 |
| 2017-01-05 |              1 |
| 2017-01-06 |              1 |


Table #6
Filename: source_5.csv
Sample Rows in Markdown:
| start      |   betterliving |
|:-----------|---------------:|
| 2016-07-29 |              1 |
| 2016-07-30 |              1 |
| 2016-07-31 |              1 |
| 2016-08-01 |              1 |
| 2016-08-02 |              1 |
| 2016-08-03 |              1 |
| 2016-08-04 |              1 |
| 2016-08-05 |              1 |
| 2016-08-06 |              1 |
| 2016-08-07 |              1 |


Table #7
Filename: source_6.csv
Sample Rows in Markdown:
| start      |   betterliving |
|:-----------|---------------:|
| 2016-10-13 |              1 |
| 2016-10-14 |              1 |
| 2016-10-15 |              1 |
| 2016-10-16 |              1 |
| 2016-10-17 |              1 |
| 2016-10-18 |              1 |
| 2016-10-19 |              1 |
| 2016-10-20 |              1 |
| 2016-10-21 |              1 |
| 2016-10-22 |              1 |


Table #8
Filename: source_7.csv
Sample Rows in Markdown:
| start      |   betterliving |
|:-----------|---------------:|
| 2018-03-27 |              1 |
| 2018-03-28 |              1 |
| 2018-03-29 |              1 |
| 2018-03-30 |              1 |
| 2018-03-31 |              1 |
| 2018-04-01 |              1 |
| 2018-04-02 |              1 |
| 2018-04-03 |              1 |
| 2018-04-04 |              1 |
| 2018-04-05 |              1 |


Table #9
Filename: source_8.csv
Sample Rows in Markdown:
| start      |   betterliving |
|:-----------|---------------:|
| 2017-09-15 |              1 |
| 2017-09-16 |              1 |
| 2017-09-17 |              1 |
| 2017-09-18 |              1 |
| 2017-09-19 |              1 |
| 2017-09-20 |              1 |
| 2017-09-21 |              1 |
| 2017-09-22 |              1 |
| 2017-09-23 |              1 |
| 2017-09-24 |              1 |


Table #10
Filename: source_9.csv
Sample Rows in Markdown:
| start      |   betterliving |
|:-----------|---------------:|
| 2017-01-31 |              1 |
| 2017-02-01 |              1 |
| 2017-02-02 |              1 |
| 2017-02-03 |              1 |
| 2017-02-04 |              1 |
| 2017-02-05 |              1 |
| 2017-02-06 |              1 |
| 2017-02-07 |              1 |
| 2017-02-08 |              1 |
| 2017-02-09 |              1 |


Target Schema:
| start      |   betterliving |
|:-----------|---------------:|
| 2016-04-17 |              1 |
| 2016-04-18 |              1 |
| 2016-04-19 |              1 |
| 2016-04-20 |              1 |
| 2016-04-21 |              1 |
| 2016-04-22 |              1 |
| 2016-04-23 |              1 |
| 2016-04-24 |              1 |
| 2016-04-25 |              1 |
| 2016-04-26 |              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
source_7.csv
source_8.csv
source_9.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
test_8.csv
test_9.csv