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:
|   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 #2
Filename: source_1.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 #3
Filename: source_2.csv
Sample Rows in Markdown:
|   user id |   movie id |   rating |   timestamp |
|----------:|-----------:|---------:|------------:|
|       748 |        451 |        1 | 8.79455e+08 |
|       792 |        118 |        2 | 8.77911e+08 |
|       455 |        463 |        4 | 8.79112e+08 |
|       887 |        225 |        4 | 8.81379e+08 |
|       761 |       1272 |        1 | 8.7619e+08  |
|       592 |        895 |        3 | 8.82608e+08 |
|       286 |       1053 |        4 | 8.77532e+08 |
|       808 |        286 |        4 | 8.8395e+08  |
|       239 |       1115 |        2 | 8.89181e+08 |
|       262 |        216 |        3 | 8.79793e+08 |


Target Schema:
| movie title                                 |   movie id |   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 |   user id |   rating |   timestamp |   age |   gender |   occupation |   zip code |
|:--------------------------------------------|-----------:|---------------:|---------------------:|-----------:|----------:|---------:|------------:|------------:|------------:|---------:|--------:|--------------:|--------:|----------:|------------:|---------:|----------:|----------:|-----------:|---------:|-----------:|------:|----------:|----------:|---------:|------------:|------:|---------:|-------------:|-----------:|
| 'Til There Was You (1997)                   |          6 |              6 |                    0 |          6 |         6 |        6 |           6 |           6 |           6 |        6 |       6 |             6 |       6 |         6 |           6 |        6 |         6 |         6 |          6 |        6 |          6 |     6 |         6 |         6 |        6 |           6 |     6 |        6 |            6 |          6 |
| 1-900 (1994)                                |          2 |              2 |                    0 |          2 |         2 |        2 |           2 |           2 |           2 |        2 |       2 |             2 |       2 |         2 |           2 |        2 |         2 |         2 |          2 |        2 |          2 |     2 |         2 |         2 |        2 |           2 |     2 |        2 |            2 |          2 |
| 101 Dalmatians (1996)                       |         52 |             52 |                    0 |         52 |        52 |       52 |          52 |          52 |          52 |       52 |      52 |            52 |      52 |        52 |          52 |       52 |        52 |        52 |         52 |       52 |         52 |    52 |        52 |        52 |       52 |          52 |    52 |       52 |           52 |         52 |
| 12 Angry Men (1957)                         |         61 |             61 |                    0 |         61 |        61 |       61 |          61 |          61 |          61 |       61 |      61 |            61 |      61 |        61 |          61 |       61 |        61 |        61 |         61 |       61 |         61 |    61 |        61 |        61 |       61 |          61 |    61 |       61 |           61 |         61 |
| 187 (1997)                                  |         18 |             18 |                    0 |         18 |        18 |       18 |          18 |          18 |          18 |       18 |      18 |            18 |      18 |        18 |          18 |       18 |        18 |        18 |         18 |       18 |         18 |    18 |        18 |        18 |       18 |          18 |    18 |       18 |           18 |         18 |
| 2 Days in the Valley (1996)                 |         39 |             39 |                    0 |         39 |        39 |       39 |          39 |          39 |          39 |       39 |      39 |            39 |      39 |        39 |          39 |       39 |        39 |        39 |         39 |       39 |         39 |    39 |        39 |        39 |       39 |          39 |    39 |       39 |           39 |         39 |
| 20,000 Leagues Under the Sea (1954)         |         31 |             31 |                    0 |         31 |        31 |       31 |          31 |          31 |          31 |       31 |      31 |            31 |      31 |        31 |          31 |       31 |        31 |        31 |         31 |       31 |         31 |    31 |        31 |        31 |       31 |          31 |    31 |       31 |           31 |         31 |
| 2001: A Space Odyssey (1968)                |        128 |            128 |                    0 |        128 |       128 |      128 |         128 |         128 |         128 |      128 |     128 |           128 |     128 |       128 |         128 |      128 |       128 |       128 |        128 |      128 |        128 |   128 |       128 |       128 |      128 |         128 |   128 |      128 |          128 |        128 |
| 3 Ninjas: High Noon At Mega Mountain (1998) |          4 |              4 |                    0 |          4 |         4 |        4 |           4 |           4 |           4 |        4 |       4 |             4 |       4 |         4 |           4 |        4 |         4 |         4 |          4 |        4 |          4 |     4 |         4 |         4 |        4 |           4 |     4 |        4 |            4 |          4 |
| 39 Steps, The (1935)                        |         31 |             31 |                    0 |         31 |        31 |       31 |          31 |          31 |          31 |       31 |      31 |            31 |      31 |        31 |          31 |       31 |        31 |        31 |         31 |       31 |         31 |    31 |        31 |        31 |       31 |          31 |    31 |       31 |           31 |         31 |

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