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 | title                                                | release_date   | video_release_date   | imdb_url                                                       |
|-----------:|:-----------------------------------------------------|:---------------|:---------------------|:---------------------------------------------------------------|
|          1 | Toy Story (1995)                                     | 01-Jan-1995    |                      | http://us.imdb.com/M/title-exact?Toy%20Story%20(1995)          |
|          2 | GoldenEye (1995)                                     | 01-Jan-1995    |                      | http://us.imdb.com/M/title-exact?GoldenEye%20(1995)            |
|          3 | Four Rooms (1995)                                    | 01-Jan-1995    |                      | http://us.imdb.com/M/title-exact?Four%20Rooms%20(1995)         |
|          4 | Get Shorty (1995)                                    | 01-Jan-1995    |                      | http://us.imdb.com/M/title-exact?Get%20Shorty%20(1995)         |
|          5 | Copycat (1995)                                       | 01-Jan-1995    |                      | http://us.imdb.com/M/title-exact?Copycat%20(1995)              |
|          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)   |
|          7 | Twelve Monkeys (1995)                                | 01-Jan-1995    |                      | http://us.imdb.com/M/title-exact?Twelve%20Monkeys%20(1995)     |
|          8 | Babe (1995)                                          | 01-Jan-1995    |                      | http://us.imdb.com/M/title-exact?Babe%20(1995)                 |
|          9 | Dead Man Walking (1995)                              | 01-Jan-1995    |                      | http://us.imdb.com/M/title-exact?Dead%20Man%20Walking%20(1995) |
|         10 | Richard III (1995)                                   | 22-Jan-1996    |                      | http://us.imdb.com/M/title-exact?Richard%20III%20(1995)        |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
|   user_id |   movie_id |   rating |   unix_timestamp |
|----------:|-----------:|---------:|-----------------:|
|       655 |        896 |        4 |      8.87475e+08 |
|       488 |        178 |        4 |      8.91294e+08 |
|       717 |        245 |        4 |      8.84642e+08 |
|       311 |         79 |        4 |      8.84365e+08 |
|       674 |        300 |        3 |      8.87762e+08 |
|       827 |        302 |        4 |      8.82201e+08 |
|       267 |        135 |        5 |      8.78972e+08 |
|       748 |        208 |        4 |      8.79455e+08 |
|       286 |        240 |        3 |      8.76522e+08 |
|        91 |        183 |        5 |      8.91439e+08 |


Table #3
Filename: source_2.csv
Sample Rows in Markdown:
|   user_id |   age | sex   | 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 |


Target Schema:
| title                                       |   movie_id | video_release_date   |   user_id |   rating |   unix_timestamp |     age |
|:--------------------------------------------|-----------:|:---------------------|----------:|---------:|-----------------:|--------:|
| 'Til There Was You (1997)                   |       1300 |                      |   306.833 |  2.33333 |      8.86171e+08 | 25.3333 |
| 1-900 (1994)                                |       1353 |                      |   395     |  2.5     |      8.82495e+08 | 29      |
| 101 Dalmatians (1996)                       |        225 |                      |   278.365 |  2.94231 |      8.82724e+08 | 31.9615 |
| 12 Angry Men (1957)                         |        178 |                      |   298.295 |  4.31148 |      8.82607e+08 | 35.6885 |
| 187 (1997)                                  |        330 |                      |   434.611 |  2.88889 |      8.8607e+08  | 30.7222 |
| 2 Days in the Valley (1996)                 |       1011 |                      |   297.846 |  3.25641 |      8.82683e+08 | 31.2308 |
| 20,000 Leagues Under the Sea (1954)         |        141 |                      |   292.516 |  3.48387 |      8.83531e+08 | 34.2903 |
| 2001: A Space Odyssey (1968)                |        135 |                      |   291.875 |  4.08594 |      8.82898e+08 | 34.5156 |
| 3 Ninjas: High Noon At Mega Mountain (1998) |        314 |                      |   207.5   |  1       |      8.87149e+08 | 31.75   |
| 39 Steps, The (1935)                        |        615 |                      |   363.581 |  4       |      8.83231e+08 | 40.9677 |

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