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:
| city            | date                |   fare |       ride_id |
|:----------------|:--------------------|-------:|--------------:|
| New Aaron       | 2016-06-04 02:23:05 |  20.53 | 2321624903569 |
| New David       | 2016-05-03 16:38:23 |  32.12 |  141206269867 |
| Aprilchester    | 2016-10-14 13:03:43 |  17.94 | 6499432941564 |
| Port Josephfurt | 2016-10-31 04:48:36 |  41.94 | 3151468117803 |
| Nguyenbury      | 2016-09-29 23:40:50 |  35.73 | 1542525861890 |
| Arnoldview      | 2016-08-04 11:44:19 |  29.49 | 9822259629136 |
| Pearsonberg     | 2016-03-29 12:59:03 |  36.4  | 9393126938175 |
| New Maryport    | 2016-07-13 10:19:13 |  11.96 | 5603767195344 |
| New Maryport    | 2016-08-27 12:46:27 |  32.67 |  836543255832 |
| Stewartview     | 2016-06-10 14:50:02 |  31.47 | 5397544665778 |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
| city              |   driver_count | type   |
|:------------------|---------------:|:-------|
| Kelseyland        |             63 | Urban  |
| Nguyenbury        |              8 | Urban  |
| East Douglas      |             12 | Urban  |
| West Dawnfurt     |             34 | Urban  |
| Rodriguezburgh    |             52 | Urban  |
| South Josephville |              4 | Urban  |
| West Sydneyhaven  |             70 | Urban  |
| Travisville       |             37 | Urban  |
| Torresshire       |             70 | Urban  |
| Lisaville         |             66 | Urban  |


Target Schema:
| City         |   Average Fare ($) |   Number of Rides |   Number of Drivers | City Type   |
|:-------------|-------------------:|------------------:|--------------------:|:------------|
| Alvarezhaven |            25.4309 |       5.7071e+12  |                  21 | Urban       |
| Alyssaberg   |            21.7164 |       3.74997e+12 |                  67 | Urban       |
| Antoniomouth |            20.2943 |       4.40008e+12 |                  21 | Urban       |
| Aprilchester |            21.4736 |       4.58268e+12 |                  49 | Urban       |
| Arnoldview   |            25.4652 |       5.05051e+12 |                  41 | Urban       |
| Carrollfort  |            25.92   |       4.43293e+12 |                  55 | Urban       |
| Davidtown    |            23.1426 |       5.61469e+12 |                  73 | Urban       |
| Davistown    |            19.519  |       3.98121e+12 |                  25 | Urban       |
| East Douglas |            25.8482 |       4.97565e+12 |                  12 | Urban       |
| East Erin    |            24.8953 |       5.09862e+12 |                  43 | Urban       |

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