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 |
|:--------------------|:--------------------|-------:|--------------:|
| Leahton             | 2018-02-28 20:02:59 |  31.01 | 2116500207936 |
| Johnton             | 2018-04-11 14:40:12 |  16.63 | 7248459450448 |
| Port David          | 2018-01-21 02:29:36 |  32.92 |  857956984195 |
| New Kimberlyborough | 2018-04-01 04:31:44 |  35.11 | 8275820093507 |
| Port Frank          | 2018-02-26 05:03:19 |  25.18 | 7280804922163 |
| Barajasview         | 2018-01-24 05:58:33 |   9.21 | 1841073494391 |
| South Phillip       | 2018-04-21 10:31:27 |  32.85 | 2752328490329 |
| North Jasmine       | 2018-04-03 13:15:16 |  19.66 | 9206122228723 |
| New Kimberlyborough | 2018-03-13 09:48:42 |  14.84 | 1839171122889 |
| North Jasmine       | 2018-01-05 16:39:33 |  26.72 | 3669060555225 |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
| city          |   driver_count | type   |
|:--------------|---------------:|:-------|
| Richardfort   |             38 | Urban  |
| Williamsstad  |             59 | Urban  |
| Port Angela   |             67 | Urban  |
| Rodneyfort    |             34 | Urban  |
| West Robert   |             39 | Urban  |
| West Anthony  |             70 | Urban  |
| West Angela   |             48 | Urban  |
| Martinezhaven |             25 | Urban  |
| Karenberg     |             22 | Urban  |
| Barajasview   |             26 | Urban  |


Target Schema:
| city        |   driver_count | type   | date                |   fare |       ride_id |
|:------------|---------------:|:-------|:--------------------|-------:|--------------:|
| Richardfort |             38 | Urban  | 2018-02-24 08:40:38 |  13.93 | 5628545007794 |
| Richardfort |             38 | Urban  | 2018-02-13 12:46:07 |  14    |  910050116494 |
| Richardfort |             38 | Urban  | 2018-02-16 13:52:19 |  17.92 |  820639054416 |
| Richardfort |             38 | Urban  | 2018-02-01 20:18:28 |  10.26 | 9554935945413 |
| Richardfort |             38 | Urban  | 2018-04-17 02:26:37 |  23    |  720020655850 |
| Richardfort |             38 | Urban  | 2018-04-21 03:44:04 |   9.54 | 3698147103219 |
| Richardfort |             38 | Urban  | 2018-02-03 00:14:26 |  29.04 | 4982665519010 |
| Richardfort |             38 | Urban  | 2018-02-08 15:50:12 |  16.55 | 2270463070874 |
| Richardfort |             38 | Urban  | 2018-04-03 15:07:34 |  40.77 | 9496210735824 |
| Richardfort |             38 | Urban  | 2018-02-19 14:09:20 |  27.11 | 8690324801449 |

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