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 | 2007-05-01 |     83 |     50 | 67     | 14       |         51 |        56 | 0      | 2      | 0448      | 1849     |           | 0       | M        | 0.0        | 0.00          |         29.1  |      29.82 |           1.7 |          27 |        9.2 |
|         2 | 2007-05-01 |     84 |     52 | 68     | M        |         51 |        57 | 0      | 3      | -         | -        |           | M       | M        | M          | 0.00          |         29.18 |      29.82 |           2.7 |          25 |        9.6 |
|         1 | 2007-05-02 |     59 |     42 | 51     | -3       |         42 |        47 | 14     | 0      | 0447      | 1850     | BR        | 0       | M        | 0.0        | 0.00          |         29.38 |      30.09 |          13   |           4 |       13.4 |
|         2 | 2007-05-02 |     60 |     43 | 52     | M        |         42 |        47 | 13     | 0      | -         | -        | BR HZ     | M       | M        | M          | 0.00          |         29.44 |      30.08 |          13.3 |           2 |       13.4 |
|         1 | 2007-05-03 |     66 |     46 | 56     | 2        |         40 |        48 | 9      | 0      | 0446      | 1851     |           | 0       | M        | 0.0        | 0.00          |         29.39 |      30.12 |          11.7 |           7 |       11.9 |
|         2 | 2007-05-03 |     67 |     48 | 58     | M        |         40 |        50 | 7      | 0      | -         | -        | HZ        | M       | M        | M          | 0.00          |         29.46 |      30.12 |          12.9 |           6 |       13.2 |
|         1 | 2007-05-04 |     66 |     49 | 58     | 4        |         41 |        50 | 7      | 0      | 0444      | 1852     | RA        | 0       | M        | 0.0        | T             |         29.31 |      30.05 |          10.4 |           8 |       10.8 |
|         2 | 2007-05-04 |     78 |     51 | M      | M        |         42 |        50 | M      | M      | -         | -        |           | M       | M        | M          | 0.00          |         29.36 |      30.04 |          10.1 |           7 |       10.4 |
|         1 | 2007-05-05 |     66 |     53 | 60     | 5        |         38 |        49 | 5      | 0      | 0443      | 1853     |           | 0       | M        | 0.0        | T             |         29.4  |      30.1  |          11.7 |           7 |       12   |
|         2 | 2007-05-05 |     66 |     54 | 60     | M        |         39 |        50 | 5      | 0      | -         | -        |           | M       | M        | M          | T             |         29.46 |      30.09 |          11.2 |           7 |       11.5 |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
| Date       | Address                                              | Species                |   Block | Street          | Trap   | AddressNumberAndStreet             |   Latitude |   Longitude |   AddressAccuracy |   NumMosquitos |   WnvPresent |
|:-----------|:-----------------------------------------------------|:-----------------------|--------:|:----------------|:-------|:-----------------------------------|-----------:|------------:|------------------:|---------------:|-------------:|
| 2009-08-07 | 4500 North Campbell Avenue, Chicago, IL 60625, USA   | CULEX RESTUANS         |      45 | N CAMPBELL AVE  | T220   | 4500  N CAMPBELL AVE, Chicago, IL  |    41.964  |    -87.6918 |                 9 |              2 |            0 |
| 2009-08-07 | 4600 Milwaukee Avenue, Chicago, IL 60630, USA        | CULEX PIPIENS/RESTUANS |      46 | N MILWAUKEE AVE | T003   | 4600  N MILWAUKEE AVE, Chicago, IL |    41.9642 |    -87.7576 |                 8 |              5 |            0 |
| 2009-08-07 | 4600 Milwaukee Avenue, Chicago, IL 60630, USA        | CULEX PIPIENS          |      46 | N MILWAUKEE AVE | T003   | 4600  N MILWAUKEE AVE, Chicago, IL |    41.9642 |    -87.7576 |                 8 |              1 |            0 |
| 2009-08-07 | 7000 North Moselle Avenue, Chicago, IL 60646, USA    | CULEX PIPIENS/RESTUANS |      70 | N MOSELL AVE    | T008   | 7000  N MOSELL AVE, Chicago, IL    |    42.0083 |    -87.7779 |                 9 |              2 |            0 |
| 2009-08-07 | 6100 North Lemont Avenue, Chicago, IL 60646, USA     | CULEX PIPIENS/RESTUANS |      61 | N LEMONT AVE    | T012   | 6100  N LEMONT AVE, Chicago, IL    |    41.9914 |    -87.7471 |                 8 |              2 |            0 |
| 2009-08-07 | 6100 North Lemont Avenue, Chicago, IL 60646, USA     | CULEX PIPIENS          |      61 | N LEMONT AVE    | T012   | 6100  N LEMONT AVE, Chicago, IL    |    41.9914 |    -87.7471 |                 8 |              1 |            0 |
| 2009-08-07 | 3000 West 18th Street, Chicago, IL 60608, USA        | CULEX PIPIENS/RESTUANS |      30 | W 18TH ST       | T043   | 3000  W 18TH ST, Chicago, IL       |    41.8574 |    -87.695  |                 8 |              3 |            0 |
| 2009-08-07 | 3000 West 18th Street, Chicago, IL 60608, USA        | CULEX PIPIENS          |      30 | W 18TH ST       | T043   | 3000  W 18TH ST, Chicago, IL       |    41.8574 |    -87.695  |                 8 |              2 |            0 |
| 2009-08-07 | 1100 South California Avenue, Chicago, IL 60612, USA | CULEX PIPIENS/RESTUANS |      11 | S CALIFORNIA    | T047   | 1100  S CALIFORNIA, Chicago, IL    |    41.8681 |    -87.6963 |                 9 |              1 |            0 |
| 2009-08-07 | 6100 West Fullerton Avenue, Chicago, IL 60639, USA   | CULEX PIPIENS/RESTUANS |      61 | W FULLERTON AVE | T013   | 6100  W FULLERTON AVE, Chicago, IL |    41.9237 |    -87.7853 |                 9 |              9 |            0 |


Target Schema:
| Date       |   NumMosquitos |
|:-----------|---------------:|
| 2007-05-29 |             80 |
| 2007-06-05 |            254 |
| 2007-06-26 |            432 |
| 2007-06-29 |            170 |
| 2007-07-02 |            480 |
| 2007-07-11 |           2206 |
| 2007-07-18 |           1706 |
| 2007-07-19 |           1374 |
| 2007-07-25 |           8138 |
| 2007-07-27 |            494 |

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