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:
|   Station | Date       |   Tmax |   Tmin |   Tavg | Depart   |   DewPoint |   WetBulb |   Heat |   Cool | Sunrise   | Sunset   | CodeSum   | Depth   | Water1   | SnowFall   |   PrecipTotal |   StnPressure |   SeaLevel |   ResultSpeed |   ResultDir |   AvgSpeed |
|----------:|:-----------|-------:|-------:|-------:|:---------|-----------:|----------:|-------:|-------:|:----------|:---------|:----------|:--------|:---------|:-----------|--------------:|--------------:|-----------:|--------------:|------------:|-----------:|
|         1 | 2011-05-01 |     63 |     47 |     55 | 2        |         37 |        47 |     10 |      0 | 0448      | 1849     |           | 0       | M        | 0.0        |         0     |         29.26 |      29.95 |          11.4 |          26 |       11.9 |
|         2 | 2011-05-01 |     64 |     52 |     58 | M        |         37 |        48 |      7 |      0 | -         | -        |           | M       | M        | M          |         0     |         29.32 |      29.94 |          11.2 |          26 |       11.6 |
|         1 | 2011-05-02 |     59 |     42 |     51 | -3       |         31 |        42 |     14 |      0 | 0447      | 1850     |           | 0       | M        | 0.0        |         0     |         29.46 |      30.17 |           5.3 |          36 |        9.9 |
|         2 | 2011-05-02 |     60 |     43 |     52 | M        |         31 |        42 |     13 |      0 | -         | -        |           | M       | M        | M          |         0     |         29.52 |      30.16 |           4.6 |          36 |        9.9 |
|         1 | 2011-05-03 |     50 |     37 |     44 | -10      |         31 |        38 |     21 |      0 | 0446      | 1851     | RA        | 0       | M        | 0.0        |         0.005 |         29.5  |      30.23 |           6.7 |           3 |        7.6 |
|         2 | 2011-05-03 |     51 |     38 |     45 | M        |         30 |        38 |     20 |      0 | -         | -        | DZ        | M       | M        | M          |         0.005 |         29.56 |      30.23 |           8.2 |           2 |        8.7 |
|         1 | 2011-05-04 |     59 |     37 |     48 | -6       |         29 |        40 |     17 |      0 | 0444      | 1852     |           | 0       | M        | 0.0        |         0     |         29.63 |      30.37 |           4.6 |           3 |        7.6 |
|         2 | 2011-05-04 |     57 |     37 |     47 | M        |         29 |        40 |     18 |      0 | -         | -        |           | M       | M        | M          |         0     |         29.7  |      30.37 |           4.9 |           3 |        7.3 |
|         1 | 2011-05-05 |     63 |     35 |     49 | -6       |         40 |        46 |     16 |      0 | 0443      | 1853     | RA BR     | 0       | M        | 0.0        |         0.06  |         29.33 |      30.12 |          10.9 |          20 |       11.5 |
|         2 | 2011-05-05 |     62 |     41 |     52 | M        |         39 |        46 |     13 |      0 | -         | -        | RA        | M       | M        | M          |         0.1   |         29.4  |      30.13 |          10.4 |          19 |       10.9 |


Target Schema:
|   Station |   Tmax |   Tmin |   Tavg |   Depart |   DewPoint |   WetBulb |   Heat |   Cool |   Sunrise |   Sunset |   CodeSum |   Depth |   Water1 |   SnowFall |   PrecipTotal |   StnPressure |   SeaLevel |   ResultSpeed |   ResultDir |   AvgSpeed |
|----------:|-------:|-------:|-------:|---------:|-----------:|----------:|-------:|-------:|----------:|---------:|----------:|--------:|---------:|-----------:|--------------:|--------------:|-----------:|--------------:|------------:|-----------:|
|         1 |    736 |    736 |    736 |      736 |        736 |       735 |    736 |    736 |       736 |      736 |       736 |     736 |      736 |        736 |           736 |           735 |        736 |           736 |         736 |        736 |
|         2 |    736 |    736 |    733 |      736 |        736 |       736 |    733 |    733 |       736 |      736 |       736 |     736 |      736 |        736 |           734 |           735 |        736 |           736 |         736 |        736 |

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