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:
|   tripduration | starttime                | stoptime                 |   start station id | start station name    |   start station latitude |   start station longitude |   end station id | end station name   |   end station latitude |   end station longitude |   bikeid | usertype   |   birth year |   gender |
|---------------:|:-------------------------|:-------------------------|-------------------:|:----------------------|-------------------------:|--------------------------:|-----------------:|:-------------------|-----------------------:|------------------------:|---------:|:-----------|-------------:|---------:|
|            359 | 2018-06-15 08:17:44.4180 | 2018-06-15 08:23:43.7160 |               3207 | Oakland Ave           |                  40.7376 |                  -74.0525 |             3640 | Journal Square     |                40.7337 |                -74.0625 |    26291 | Subscriber |         1991 |        2 |
|             67 | 2018-06-17 17:04:09.7600 | 2018-06-17 17:05:17.6730 |               3278 | Monmouth and 6th      |                  40.7257 |                  -74.0488 |             3269 | Brunswick & 6th    |                40.726  |                -74.0504 |    26274 | Subscriber |         1975 |        1 |
|            311 | 2018-06-04 09:22:54.3480 | 2018-06-04 09:28:06.2900 |               3279 | Dixon Mills           |                  40.7216 |                  -74.05   |             3183 | Exchange Place     |                40.7162 |                -74.0335 |    26166 | Subscriber |         1949 |        1 |
|            257 | 2018-06-15 20:30:06.4250 | 2018-06-15 20:34:23.6790 |               3276 | Marin Light Rail      |                  40.7146 |                  -74.0428 |             3186 | Grove St PATH      |                40.7196 |                -74.0431 |    26188 | Subscriber |         1982 |        1 |
|            977 | 2018-06-19 10:25:40.6390 | 2018-06-19 10:41:57.8510 |               3273 | Manila & 1st          |                  40.7217 |                  -74.0429 |             3213 | Van Vorst Park     |                40.7185 |                -74.0477 |    33565 | Subscriber |         1968 |        1 |
|             92 | 2018-06-07 18:52:29.2800 | 2018-06-07 18:54:01.4630 |               3209 | Brunswick St          |                  40.7242 |                  -74.0507 |             3279 | Dixon Mills        |                40.7216 |                -74.05   |    29271 | Subscriber |         1982 |        1 |
|            434 | 2018-06-20 11:43:02.5770 | 2018-06-20 11:50:17.1760 |               3276 | Marin Light Rail      |                  40.7146 |                  -74.0428 |             3275 | Columbus Drive     |                40.7184 |                -74.0389 |    29681 | Customer   |         1969 |        0 |
|            190 | 2018-06-08 22:08:02.3410 | 2018-06-08 22:11:13.3320 |               3270 | Jersey & 6th St       |                  40.7253 |                  -74.0456 |             3638 | Washington St      |                40.7243 |                -74.0355 |    26169 | Subscriber |         1980 |        1 |
|            270 | 2018-06-15 08:10:44.8360 | 2018-06-15 08:15:15.2100 |               3270 | Jersey & 6th St       |                  40.7253 |                  -74.0456 |             3186 | Grove St PATH      |                40.7196 |                -74.0431 |    29476 | Subscriber |         1954 |        2 |
|            494 | 2018-06-11 22:08:42.9420 | 2018-06-11 22:16:57.7620 |               3225 | Baldwin at Montgomery |                  40.7237 |                  -74.0642 |             3186 | Grove St PATH      |                40.7196 |                -74.0431 |    33636 | Subscriber |         1988 |        1 |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
|   tripduration | starttime                | stoptime                 |   start station id | start station name   |   start station latitude |   start station longitude |   end station id | end station name   |   end station latitude |   end station longitude |   bikeid | usertype   |   birth year |   gender |
|---------------:|:-------------------------|:-------------------------|-------------------:|:---------------------|-------------------------:|--------------------------:|-----------------:|:-------------------|-----------------------:|------------------------:|---------:|:-----------|-------------:|---------:|
|           1115 | 2018-05-08 14:16:37.4970 | 2018-05-08 14:35:13.1450 |               3186 | Grove St PATH        |                  40.7196 |                  -74.0431 |             3183 | Exchange Place     |                40.7162 |                -74.0335 |    26240 | Subscriber |         1984 |        1 |
|            144 | 2018-05-31 07:12:36.5500 | 2018-05-31 07:15:01.0410 |               3272 | Jersey & 3rd         |                  40.7233 |                  -74.046  |             3273 | Manila & 1st       |                40.7217 |                -74.0429 |    26174 | Subscriber |         1970 |        1 |
|            169 | 2018-05-04 11:47:57.3860 | 2018-05-04 11:50:46.5360 |               3185 | City Hall            |                  40.7177 |                  -74.0438 |             3681 | Grand St           |                40.7152 |                -74.0377 |    29588 | Subscriber |         1991 |        1 |
|            524 | 2018-05-02 19:48:37.9060 | 2018-05-02 19:57:21.9280 |               3483 | Montgomery St        |                  40.7194 |                  -74.051  |             3203 | Hamilton Park      |                40.7276 |                -74.0442 |    29668 | Subscriber |         1969 |        0 |
|            142 | 2018-05-03 19:51:18.5310 | 2018-05-03 19:53:41.0560 |               3203 | Hamilton Park        |                  40.7276 |                  -74.0442 |             3211 | Newark Ave         |                40.7215 |                -74.0463 |    33634 | Subscriber |         1984 |        1 |
|            508 | 2018-05-25 17:00:15.7650 | 2018-05-25 17:08:43.9570 |               3214 | Essex Light Rail     |                  40.7128 |                  -74.0365 |             3186 | Grove St PATH      |                40.7196 |                -74.0431 |    26161 | Subscriber |         1986 |        1 |
|            317 | 2018-05-15 06:20:08.2160 | 2018-05-15 06:25:25.7710 |               3269 | Brunswick & 6th      |                  40.726  |                  -74.0504 |             3186 | Grove St PATH      |                40.7196 |                -74.0431 |    29471 | Subscriber |         1981 |        2 |
|            306 | 2018-05-14 17:31:34.7390 | 2018-05-14 17:36:41.4630 |               3186 | Grove St PATH        |                  40.7196 |                  -74.0431 |             3276 | Marin Light Rail   |                40.7146 |                -74.0428 |    29674 | Subscriber |         1983 |        1 |
|            432 | 2018-05-19 16:57:26.6070 | 2018-05-19 17:04:38.6550 |               3195 | Sip Ave              |                  40.7307 |                  -74.0638 |             3209 | Brunswick St       |                40.7242 |                -74.0507 |    26195 | Subscriber |         1989 |        1 |
|            397 | 2018-05-23 08:43:01.5960 | 2018-05-23 08:49:39.5860 |               3192 | Liberty Light Rail   |                  40.7112 |                  -74.0557 |             3185 | City Hall          |                40.7177 |                -74.0438 |    26217 | Subscriber |         1987 |        1 |


Target Schema:
|   tripduration | starttime                | stoptime                 |   start station id | start station name   |   start station latitude |   start station longitude |   end station id | end station name   |   end station latitude |   end station longitude |   bikeid | usertype   |   birth year |   gender |
|---------------:|:-------------------------|:-------------------------|-------------------:|:---------------------|-------------------------:|--------------------------:|-----------------:|:-------------------|-----------------------:|------------------------:|---------:|:-----------|-------------:|---------:|
|            131 | 2018-05-01 07:29:57.5490 | 2018-05-01 07:32:08.6160 |               3183 | Exchange Place       |                  40.7162 |                  -74.0335 |             3184 | Paulus Hook        |                40.7141 |                -74.0336 |    29617 | Subscriber |         1966 |        1 |
|             73 | 2018-05-01 08:13:58.2560 | 2018-05-01 08:15:11.9230 |               3183 | Exchange Place       |                  40.7162 |                  -74.0335 |             3184 | Paulus Hook        |                40.7141 |                -74.0336 |    29288 | Subscriber |         1975 |        1 |
|           4929 | 2018-05-01 08:17:21.3110 | 2018-05-01 09:39:31.0770 |               3183 | Exchange Place       |                  40.7162 |                  -74.0335 |             3183 | Exchange Place     |                40.7162 |                -74.0335 |    29520 | Customer   |         1969 |        0 |
|            432 | 2018-05-01 08:25:58.7150 | 2018-05-01 08:33:10.8960 |               3183 | Exchange Place       |                  40.7162 |                  -74.0335 |             3202 | Newport PATH       |                40.7272 |                -74.0338 |    29595 | Subscriber |         1973 |        1 |
|            432 | 2018-05-01 08:28:09.9160 | 2018-05-01 08:35:22.1440 |               3183 | Exchange Place       |                  40.7162 |                  -74.0335 |             3638 | Washington St      |                40.7243 |                -74.0355 |    33623 | Subscriber |         1959 |        1 |
|           3191 | 2018-05-01 10:05:06.9770 | 2018-05-01 10:58:18.6910 |               3183 | Exchange Place       |                  40.7162 |                  -74.0335 |             3212 | Christ Hospital    |                40.7348 |                -74.0504 |    33593 | Customer   |         1969 |        0 |
|            446 | 2018-05-01 12:09:18.8750 | 2018-05-01 12:16:44.8850 |               3183 | Exchange Place       |                  40.7162 |                  -74.0335 |             3202 | Newport PATH       |                40.7272 |                -74.0338 |    33577 | Subscriber |         1969 |        0 |
|            408 | 2018-05-01 12:34:14.5520 | 2018-05-01 12:41:02.8900 |               3183 | Exchange Place       |                  40.7162 |                  -74.0335 |             3202 | Newport PATH       |                40.7272 |                -74.0338 |    33668 | Subscriber |         1985 |        1 |
|           1949 | 2018-05-01 13:22:33.3030 | 2018-05-01 13:55:02.8290 |               3183 | Exchange Place       |                  40.7162 |                  -74.0335 |             3184 | Paulus Hook        |                40.7141 |                -74.0336 |    26158 | Subscriber |         1973 |        1 |
|            194 | 2018-05-01 13:32:46.5260 | 2018-05-01 13:36:01.2370 |               3183 | Exchange Place       |                  40.7162 |                  -74.0335 |             3214 | Essex Light Rail   |                40.7128 |                -74.0365 |    26217 | Subscriber |         1954 |        2 |

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