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              |   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  |


Table #2
Filename: source_1.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.11 |  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.72 | 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 |


Target Schema:
| City         |   Average Fare |     ride_id |   Total Number of Rides | City Type   |   Total Number of Drivers |
|:-------------|---------------:|------------:|------------------------:|:------------|--------------------------:|
| Alvarezhaven |          25.43 | 5.7071e+12  |                      22 | Urban       |                        21 |
| Alyssaberg   |          21.71 | 3.74997e+12 |                      22 | Urban       |                        67 |
| Antoniomouth |          20.29 | 4.40008e+12 |                      14 | Urban       |                        21 |
| Aprilchester |          21.47 | 4.58268e+12 |                      11 | Urban       |                        49 |
| Arnoldview   |          25.46 | 5.05051e+12 |                      25 | Urban       |                        41 |
| Carrollfort  |          25.92 | 4.43293e+12 |                      23 | Urban       |                        55 |
| Davidtown    |          23.14 | 5.61469e+12 |                      19 | Urban       |                        73 |
| Davistown    |          19.51 | 3.98121e+12 |                      21 | Urban       |                        25 |
| East Douglas |          25.84 | 4.97565e+12 |                      17 | Urban       |                        12 |
| East Erin    |          24.89 | 5.09862e+12 |                      19 | Urban       |                        43 |

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