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:
| msno                                         | date       |   date_diff |
|:---------------------------------------------|:-----------|------------:|
| ++tofICy5EV1xvkICkAQ5aFFjlCjoTknWWfb9lz+I0Q= | 2017-01-15 |           1 |
| ++nPmTjej8IMwfA+zZXSkkHM/MhR1ibBIdwTVNMGneg= | 2016-12-26 |           1 |
| ++vWe05qm+bN0w2uEWNQC/q9asWKGQyZtrlhj/yCleE= | 2016-08-01 |           1 |
| ++ghRXf+f258JCBO1BBgs2KvK3YPdtNjJXPkgTkzwqQ= | 2015-04-13 |           1 |
| ++laFYWTCjjGfTqT47mTBxY6i25nwhpuhJeIm4Oafl0= | 2015-06-28 |           1 |
| ++pCffaply7OuAlbcK4QgrwyNAbxYgoL+0gXW/XjIIo= | 2015-06-30 |           1 |
| ++oXIXmgqlMjdoyLncPieObbuXZeSHGDsI6xk15WkIM= | 2017-02-01 |           1 |
| +//9VypSJTaZ25sTPVT8b1FfIwWaVunRnyJAMBpxsBw= | 2015-06-20 |           1 |
| ++laFYWTCjjGfTqT47mTBxY6i25nwhpuhJeIm4Oafl0= | 2015-11-01 |           1 |
| ++rGlQmV4d2KvewtsXvImb2GYo4KsGZwUA+T/hcEsz4= | 2016-03-03 |           1 |


Target Schema:
| msno                                         |   date_diff |   date_diff-min |   date_diff-max |   date_diff-median |   date_diff-std |
|:---------------------------------------------|------------:|----------------:|----------------:|-------------------:|----------------:|
| +++hVY1rZox/33YtvDgmKA2Frg/2qhkz12B9ylCvh8o= |     1.01961 |               1 |               2 |                102 |             102 |
| +++l/EXNMLTijfLBa8p2TUVVVp2aFGSuUI/h7mLmthw= |     1.29605 |               1 |              14 |                608 |             608 |
| +++snpr7pmobhLKUgSHTv/mpkqgBT0tQJ0zQj6qKrqc= |     1.31063 |               1 |               9 |                602 |             602 |
| ++/9R3sX37CjxbY/AaGvbwr3QkwElKBCtSvVzhCBDOk= |     1.19588 |               1 |               6 |                291 |             291 |
| ++/UDNo9DLrxT8QVGiDi1OnWfczAdEwThaVyD0fXO50= |     1.76577 |               1 |              10 |                444 |             444 |
| ++/ZHqwUNa7U21Qz+zqteiXlZapxey86l6eEorrak/g= |     3.86979 |               1 |              72 |                192 |             192 |
| ++0/NopttBsaAn6qHZA2AWWrDg7Me7UOMs1vsyo4tSI= |     2.87395 |               1 |              16 |                119 |             119 |
| ++0BJXY8tpirgIhJR14LDM1pnaRosjD1mdO1mIKxlJA= |     2.61468 |               1 |              17 |                218 |             218 |
| ++0EzISdtKY48Z0GY62jer/LFQwrNIAbADdtU5xStGY= |     1.64286 |               1 |              32 |                196 |             196 |
| ++1G0wVY14Lp0VXak1ymLhPUdXPSFJVBnjWwzGxBKJs= |     2.20248 |               1 |              13 |                242 |             242 |

Return only the final code in markdown codeblock format, without any additional text or explanation. 



target: target.csv
train: source_0.csv
test: test_0.csv