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:
|   budget | genres                                                                                                                               | homepage                                           |   movie_id | keywords                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | original_language   | original_title                  | overview                                                                                                                                                                                                                                                                                                                                                                                   |   popularity | production_companies                                                                                                                                                                                                                                                                      | production_countries                                                                                                                                                             | release_date   |   revenue |   runtime | spoken_languages                                                                       | status   | tagline                                                             | title                           |   vote_average |   vote_count |   year |
|---------:|:-------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------|-----------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------|:--------------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------|----------:|----------:|:---------------------------------------------------------------------------------------|:---------|:--------------------------------------------------------------------|:--------------------------------|---------------:|-------------:|-------:|
|        0 | [{"id": 53, "name": "Thriller"}]                                                                                                     |                                                    |      31932 | []                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | en                  | City of Ghosts                  | A con man (Dillon) travels to Cambodia (also on the run from law enforcement in the U.S.) to collect his share in an insurance scam, but discovers more than he bargained for                                                                                                                                                                                                              |      2.64486 | []                                                                                                                                                                                                                                                                                        | [{"iso_3166_1": "US", "name": "United States of America"}]                                                                                                                       | 2002-01-01     |         0 |       116 | [{"iso_639_1": "en", "name": "English"}]                                               | Released |                                                                     | City of Ghosts                  |            5.4 |           18 |   2002 |
|        0 | [{"id": 27, "name": "Horror"}, {"id": 18, "name": "Drama"}, {"id": 9648, "name": "Mystery"}, {"id": 53, "name": "Thriller"}]         |                                                    |       1933 | [{"id": 2341, "name": "nanny"}, {"id": 3358, "name": "haunted house"}, {"id": 5911, "name": "channel islands"}, {"id": 33465, "name": "parallel world"}, {"id": 166591, "name": "photosensitivity"}, {"id": 210530, "name": "spiritism"}]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | en                  | The Others                      | Grace is a religious woman who lives in an old house kept dark because her two children, Anne and Nicholas, have a rare sensitivity to light. When the family begins to suspect the house is haunted, Grace fights to protect her children at any cost in the face of strange events and disturbing visions.                                                                               |     25.8814  | [{"name": "Cruise/Wagner Productions", "id": 44}, {"name": "Canal Plus", "id": 104}, {"name": "Sogecine", "id": 692}, {"name": "Las Producciones del Escorpion", "id": 778}, {"name": "Lucky Red", "id": 779}, {"name": "Dimension Films", "id": 7405}, {"name": "Miramax", "id": 53009}] | [{"iso_3166_1": "ES", "name": "Spain"}, {"iso_3166_1": "US", "name": "United States of America"}, {"iso_3166_1": "FR", "name": "France"}, {"iso_3166_1": "IT", "name": "Italy"}] | 2001-08-02     |         0 |       101 | [{"iso_639_1": "fr", "name": "Fran\u00e7ais"}, {"iso_639_1": "en", "name": "English"}] | Released | Sooner or later she'll see them, then everything will be different. | The Others                      |            7.4 |         1660 |   2001 |
| 18500000 | [{"id": 27, "name": "Horror"}, {"id": 28, "name": "Action"}, {"id": 53, "name": "Thriller"}, {"id": 878, "name": "Science Fiction"}] |                                                    |        679 | [{"id": 803, "name": "android"}, {"id": 1603, "name": "extraterrestrial technology"}, {"id": 1826, "name": "space marine"}, {"id": 2345, "name": "spaceman"}, {"id": 3385, "name": "cryogenics"}, {"id": 3387, "name": "vacuum"}, {"id": 3388, "name": "space colony"}, {"id": 3389, "name": "warrior woman"}, {"id": 3591, "name": "settler"}, {"id": 3801, "name": "space travel"}, {"id": 4090, "name": "colony"}, {"id": 9951, "name": "alien"}, {"id": 226177, "name": "xenomorph"}]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | en                  | Aliens                          | When Ripley's lifepod is found by a salvage crew over 50 years later, she finds that terra-formers are on the very planet they found the alien species. When the company sends a family of colonists out to investigate her story, all contact is lost with the planet and colonists. They enlist Ripley and the colonial marines to return and search for answers.                        |     67.6609  | [{"name": "Twentieth Century Fox Film Corporation", "id": 306}, {"name": "SLM Production Group", "id": 396}, {"name": "Brandywine Productions", "id": 19747}]                                                                                                                             | [{"iso_3166_1": "GB", "name": "United Kingdom"}, {"iso_3166_1": "US", "name": "United States of America"}]                                                                       | 1986-07-18     | 183316455 |       137 | [{"iso_639_1": "en", "name": "English"}]                                               | Released | This Time It's War                                                  | Aliens                          |            7.7 |         3220 |   1986 |
| 17000000 | [{"id": 18, "name": "Drama"}, {"id": 10751, "name": "Family"}, {"id": 10402, "name": "Music"}, {"id": 10749, "name": "Romance"}]     |                                                    |      11113 | [{"id": 4344, "name": "musical"}, {"id": 4375, "name": "transformation"}, {"id": 4485, "name": "flower girl"}, {"id": 10786, "name": "colonel"}, {"id": 11411, "name": "wager"}, {"id": 11707, "name": "suitor"}, {"id": 14514, "name": "class differences"}, {"id": 18015, "name": "tutor"}, {"id": 155697, "name": "aristocrat"}, {"id": 165278, "name": "linguist"}, {"id": 165279, "name": "street"}, {"id": 165282, "name": "high society"}, {"id": 165288, "name": "misogynist"}, {"id": 165290, "name": "guttersnipe"}, {"id": 165299, "name": "class prejudice"}, {"id": 165301, "name": "opposites attract"}]                                                                                                                                                                                                                                                                                                                                                                                                         | en                  | My Fair Lady                    | A misogynistic and snobbish phonetics professor agrees to a wager that he can take a flower girl and make her presentable in high society.                                                                                                                                                                                                                                                 |     20.7866  | [{"name": "Warner Bros.", "id": 6194}]                                                                                                                                                                                                                                                    | [{"iso_3166_1": "US", "name": "United States of America"}]                                                                                                                       | 1964-10-21     |  72070731 |       170 | [{"iso_639_1": "en", "name": "English"}]                                               | Released | The loverliest motion picture of them all!                          | My Fair Lady                    |            7.4 |          352 |   1964 |
| 17000000 | [{"id": 27, "name": "Horror"}, {"id": 53, "name": "Thriller"}, {"id": 9648, "name": "Mystery"}]                                      |                                                    |       3597 | [{"id": 1328, "name": "secret"}, {"id": 1936, "name": "blackmail"}, {"id": 5420, "name": "fisherman"}, {"id": 6149, "name": "police"}, {"id": 6270, "name": "high school"}, {"id": 9665, "name": "cover-up"}, {"id": 9713, "name": "friends"}, {"id": 9748, "name": "revenge"}, {"id": 9826, "name": "murder"}, {"id": 10225, "name": "pageant"}, {"id": 12339, "name": "slasher"}, {"id": 13130, "name": "teenager"}, {"id": 15127, "name": "killer"}]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | en                  | I Know What You Did Last Summer | As they celebrate their high school graduation, four friends are involved in a hit-and-run accident when their car hits and apparently kills a pedestrian on an isolated roadway. They dispose of the body and vow to keep the incident a secret, a year later somebody starts sending them letters bearing the warning "I Know What You Did Last Summer."                                 |     27.6545  | [{"name": "Columbia Pictures Corporation", "id": 441}, {"name": "Mandalay Entertainment", "id": 1236}, {"name": "Summer Knowledge LLC", "id": 1464}]                                                                                                                                      | [{"iso_3166_1": "US", "name": "United States of America"}]                                                                                                                       | 1997-10-17     | 125586134 |       100 | [{"iso_639_1": "en", "name": "English"}]                                               | Released | If you're going to bury the truth, make sure it stays buried.       | I Know What You Did Last Summer |            5.6 |          687 |   1997 |
| 17000000 | [{"id": 35, "name": "Comedy"}]                                                                                                       |                                                    |     193893 | [{"id": 417, "name": "corruption"}, {"id": 642, "name": "robbery"}, {"id": 1930, "name": "kidnapping"}, {"id": 2334, "name": "nightclub"}, {"id": 3230, "name": "male friendship"}, {"id": 5340, "name": "investigation"}, {"id": 6149, "name": "police"}, {"id": 8508, "name": "party"}, {"id": 9826, "name": "murder"}, {"id": 11578, "name": "mobster"}, {"id": 12670, "name": "los angeles"}, {"id": 170682, "name": "lying"}, {"id": 185071, "name": "impersonating a police officer"}, {"id": 187844, "name": "flashback"}]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | en                  | Let's Be Cops                   | It's the ultimate buddy cop movie except for one thing: they're not cops.  When two struggling pals dress as police officers for a costume party, they become neighborhood sensations.  But when these newly-minted “heroes” get tangled in a real life web of mobsters and dirty detectives, they must put their fake badges on the line.                                                 |     70.6689  | [{"name": "Twentieth Century Fox Film Corporation", "id": 306}, {"name": "WideAwake", "id": 28787}, {"name": "Genre Films", "id": 28788}]                                                                                                                                                 | [{"iso_3166_1": "US", "name": "United States of America"}]                                                                                                                       | 2014-08-13     | 136621271 |       104 | [{"iso_639_1": "en", "name": "English"}]                                               | Released | Fake Cops. Real Trouble.                                            | Let's Be Cops                   |            6.4 |         1219 |   2014 |
| 16000000 | [{"id": 35, "name": "Comedy"}, {"id": 18, "name": "Drama"}, {"id": 10749, "name": "Romance"}]                                        | http://www.foxsearchlight.com/sideways/            |       9675 | [{"id": 387, "name": "california"}, {"id": 2702, "name": "golf"}, {"id": 3089, "name": "oscar award"}, {"id": 6563, "name": "wine"}, {"id": 8070, "name": "stag night"}, {"id": 10776, "name": "marijuana"}, {"id": 13028, "name": "writer"}]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | en                  | Sideways                        | Two middle-aged men embark on a spiritual journey through Californian wine country. One is an unpublished novelist suffering from depression, and the other is only days away from walking down the aisle.                                                                                                                                                                                 |     23.4254  | [{"name": "Fox Searchlight Pictures", "id": 43}, {"name": "Michael London Productions", "id": 1187}, {"name": "Sideways Productions Inc.", "id": 12157}]                                                                                                                                  | [{"iso_3166_1": "US", "name": "United States of America"}]                                                                                                                       | 2004-10-22     | 109502303 |       126 | [{"iso_639_1": "hy", "name": ""}, {"iso_639_1": "en", "name": "English"}]              | Released | In search of wine. In search of women. In search of themselves.     | Sideways                        |            6.9 |          478 |   2004 |
| 17500000 | [{"id": 35, "name": "Comedy"}]                                                                                                       |                                                    |       9988 | [{"id": 74, "name": "germany"}, {"id": 271, "name": "competition"}, {"id": 549, "name": "prostitute"}, {"id": 567, "name": "alcohol"}, {"id": 4552, "name": "beer"}, {"id": 8971, "name": "oktoberfest"}]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | en                  | Beerfest                        | During a trip to Germany to scatter their grandfather's ashes, German-American brothers Todd and Jan discover Beerfest, the secret Olympics of downing stout, and want to enter the contest to defend their family's beer-guzzling honor. Their Old Country cousins sneer at the Yanks' chances, prompting the siblings to return to America to prepare for a showdown the following year. |     14.3044  | [{"name": "Broken Lizard Industries", "id": 2773}]                                                                                                                                                                                                                                        | [{"iso_3166_1": "US", "name": "United States of America"}]                                                                                                                       | 2006-08-25     |  19179969 |       110 | [{"iso_639_1": "en", "name": "English"}, {"iso_639_1": "de", "name": "Deutsch"}]       | Released | Prepare for the ultimate chug of war.                               | Beerfest                        |            5.8 |          172 |   2006 |
|   300000 | [{"id": 27, "name": "Horror"}, {"id": 53, "name": "Thriller"}]                                                                       | http://www.theofficialjohncarpenter.com/halloween/ |        948 | [{"id": 293, "name": "female nudity"}, {"id": 2483, "name": "nudity"}, {"id": 2546, "name": "mask"}, {"id": 2604, "name": "babysitter"}, {"id": 3335, "name": "halloween"}, {"id": 6149, "name": "police"}, {"id": 10024, "name": "psychopathic killer"}, {"id": 10183, "name": "independent film"}, {"id": 10333, "name": "stalking"}, {"id": 10714, "name": "serial killer"}, {"id": 10776, "name": "marijuana"}, {"id": 11040, "name": "masked killer"}, {"id": 11221, "name": "blood"}, {"id": 11488, "name": "pot smoking"}, {"id": 12339, "name": "slasher"}, {"id": 13112, "name": "murderer"}, {"id": 14698, "name": "throat slitting"}, {"id": 14805, "name": "maniac"}, {"id": 14819, "name": "violence"}, {"id": 17987, "name": "killing spree"}, {"id": 18035, "name": "family"}, {"id": 34117, "name": "cult film"}, {"id": 156075, "name": "evil"}, {"id": 157701, "name": "psychotic"}, {"id": 174424, "name": "smoking pot"}, {"id": 198914, "name": "institution"}, {"id": 207159, "name": "escaped killer"}] | en                  | Halloween                       | In John Carpenter's horror classic, a psychotic murderer, institutionalized since childhood for the murder of his sister, escapes and stalks a bookish teenage girl and her friends while his doctor chases him through the streets.                                                                                                                                                       |     30.3013  | [{"name": "Compass International Pictures", "id": 14323}, {"name": "Falcon International Productions", "id": 22814}]                                                                                                                                                                      | [{"iso_3166_1": "US", "name": "United States of America"}]                                                                                                                       | 1978-10-25     |  70000000 |        91 | [{"iso_639_1": "en", "name": "English"}]                                               | Released | The Night He Came Home                                              | Halloween                       |            7.4 |         1035 |   1978 |
| 17000000 | [{"id": 35, "name": "Comedy"}, {"id": 10751, "name": "Family"}, {"id": 878, "name": "Science Fiction"}]                              | http://www.goodboy.com/                            |      21765 | []                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | en                  | Good Boy!                       | An intergalactic dog pilot from Sirius (the dog star), visits Earth to verify the rumors that dogs have failed to take over the planet.                                                                                                                                                                                                                                                    |      3.56033 | [{"name": "Jim Henson Pictures", "id": 6255}, {"name": "Metro-Goldwyn-Mayer (MGM)", "id": 8411}]                                                                                                                                                                                          | [{"iso_3166_1": "US", "name": "United States of America"}]                                                                                                                       | 2003-10-10     |         0 |        87 | [{"iso_639_1": "de", "name": "Deutsch"}]                                               | Released | Rover is about to take over.                                        | Good Boy!                       |            4.7 |           30 |   2003 |


Target Schema:
|   year |   0 |
|-------:|----:|
|   1940 |   1 |
|   1960 |   1 |
|   1962 |   1 |
|   1963 |   1 |
|   1964 |   1 |
|   1965 |   1 |
|   1968 |   1 |
|   1969 |   2 |
|   1970 |   4 |
|   1971 |   1 |

Return only the final code in markdown codeblock format, without any additional text or explanation. 



target: target.csv
train: source_0.csv
test: test_0.csv