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:
|   movie id | movie title                                          | release date   | video release date   | IMDb URL                                                       |   unknown |   Action |   Adventure |   Animation |   Childrens |   Comedy |   Crime |   Documentary |   Drama |   Fantasy |   Film-Noir |   Horror |   Musical |   Mystery |   Romance  |   Sci-Fi |   Thriller |   War |   Western |
|-----------:|:-----------------------------------------------------|:---------------|:---------------------|:---------------------------------------------------------------|----------:|---------:|------------:|------------:|------------:|---------:|--------:|--------------:|--------:|----------:|------------:|---------:|----------:|----------:|-----------:|---------:|-----------:|------:|----------:|
|          1 | Toy Story (1995)                                     | 01-Jan-1995    |                      | http://us.imdb.com/M/title-exact?Toy%20Story%20(1995)          |         0 |        0 |           0 |           1 |           1 |        1 |       0 |             0 |       0 |         0 |           0 |        0 |         0 |         0 |          0 |        0 |          0 |     0 |         0 |
|          2 | GoldenEye (1995)                                     | 01-Jan-1995    |                      | http://us.imdb.com/M/title-exact?GoldenEye%20(1995)            |         0 |        1 |           1 |           0 |           0 |        0 |       0 |             0 |       0 |         0 |           0 |        0 |         0 |         0 |          0 |        0 |          1 |     0 |         0 |
|          3 | Four Rooms (1995)                                    | 01-Jan-1995    |                      | http://us.imdb.com/M/title-exact?Four%20Rooms%20(1995)         |         0 |        0 |           0 |           0 |           0 |        0 |       0 |             0 |       0 |         0 |           0 |        0 |         0 |         0 |          0 |        0 |          1 |     0 |         0 |
|          4 | Get Shorty (1995)                                    | 01-Jan-1995    |                      | http://us.imdb.com/M/title-exact?Get%20Shorty%20(1995)         |         0 |        1 |           0 |           0 |           0 |        1 |       0 |             0 |       1 |         0 |           0 |        0 |         0 |         0 |          0 |        0 |          0 |     0 |         0 |
|          5 | Copycat (1995)                                       | 01-Jan-1995    |                      | http://us.imdb.com/M/title-exact?Copycat%20(1995)              |         0 |        0 |           0 |           0 |           0 |        0 |       1 |             0 |       1 |         0 |           0 |        0 |         0 |         0 |          0 |        0 |          1 |     0 |         0 |
|          6 | Shanghai Triad (Yao a yao yao dao waipo qiao) (1995) | 01-Jan-1995    |                      | http://us.imdb.com/Title?Yao+a+yao+yao+dao+waipo+qiao+(1995)   |         0 |        0 |           0 |           0 |           0 |        0 |       0 |             0 |       1 |         0 |           0 |        0 |         0 |         0 |          0 |        0 |          0 |     0 |         0 |
|          7 | Twelve Monkeys (1995)                                | 01-Jan-1995    |                      | http://us.imdb.com/M/title-exact?Twelve%20Monkeys%20(1995)     |         0 |        0 |           0 |           0 |           0 |        0 |       0 |             0 |       1 |         0 |           0 |        0 |         0 |         0 |          0 |        1 |          0 |     0 |         0 |
|          8 | Babe (1995)                                          | 01-Jan-1995    |                      | http://us.imdb.com/M/title-exact?Babe%20(1995)                 |         0 |        0 |           0 |           0 |           1 |        1 |       0 |             0 |       1 |         0 |           0 |        0 |         0 |         0 |          0 |        0 |          0 |     0 |         0 |
|          9 | Dead Man Walking (1995)                              | 01-Jan-1995    |                      | http://us.imdb.com/M/title-exact?Dead%20Man%20Walking%20(1995) |         0 |        0 |           0 |           0 |           0 |        0 |       0 |             0 |       1 |         0 |           0 |        0 |         0 |         0 |          0 |        0 |          0 |     0 |         0 |
|         10 | Richard III (1995)                                   | 22-Jan-1996    |                      | http://us.imdb.com/M/title-exact?Richard%20III%20(1995)        |         0 |        0 |           0 |           0 |           0 |        0 |       0 |             0 |       1 |         0 |           0 |        0 |         0 |         0 |          0 |        0 |          0 |     1 |         0 |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
|   user id |   age | gender   | occupation    |   zip code |
|----------:|------:|:---------|:--------------|-----------:|
|         1 |    24 | M        | technician    |      85711 |
|         2 |    53 | F        | other         |      94043 |
|         3 |    23 | M        | writer        |      32067 |
|         4 |    24 | M        | technician    |      43537 |
|         5 |    33 | F        | other         |      15213 |
|         6 |    42 | M        | executive     |      98101 |
|         7 |    57 | M        | administrator |      91344 |
|         8 |    36 | M        | administrator |      05201 |
|         9 |    29 | M        | student       |      01002 |
|        10 |    53 | M        | lawyer        |      90703 |


Table #3
Filename: source_2.csv
Sample Rows in Markdown:
|   user id |   movie id |   rating |   timestamp |
|----------:|-----------:|---------:|------------:|
|       716 |        183 |        2 | 8.79796e+08 |
|       276 |          3 |        3 | 8.74787e+08 |
|        14 |         81 |        5 | 8.90881e+08 |
|       758 |        252 |        3 | 8.80673e+08 |
|       807 |         28 |        4 | 8.92529e+08 |
|       429 |        101 |        4 | 8.82387e+08 |
|       883 |        213 |        2 | 8.91693e+08 |
|       862 |        172 |        5 | 8.79304e+08 |
|       524 |        429 |        2 | 8.84635e+08 |
|       911 |        501 |        3 | 8.92841e+08 |


Target Schema:
| movie title                                 |   rating |
|:--------------------------------------------|---------:|
| 'Til There Was You (1997)                   |  2.33333 |
| 1-900 (1994)                                |  2.5     |
| 101 Dalmatians (1996)                       |  2.94231 |
| 12 Angry Men (1957)                         |  4.31148 |
| 187 (1997)                                  |  2.88889 |
| 2 Days in the Valley (1996)                 |  3.25641 |
| 20,000 Leagues Under the Sea (1954)         |  3.48387 |
| 2001: A Space Odyssey (1968)                |  4.08594 |
| 3 Ninjas: High Noon At Mega Mountain (1998) |  1       |
| 39 Steps, The (1935)                        |  4       |

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
source_2.csv
test: test_0.csv
test_1.csv
test_2.csv