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:
| Year        | Category                | Nominee           | Movie                                     | Winner   |
|:------------|:------------------------|:------------------|:------------------------------------------|:---------|
| 2010 (83rd) | Actress -- Leading Role | Natalie Portman   | Black Swan {'Nina Sayers/The Swan Queen'} | YES      |
| 2009 (82nd) | Actress -- Leading Role | Sandra Bullock    | The Blind Side {'Leigh Anne Tuohy'}       | YES      |
| 2008 (81st) | Actress -- Leading Role | Kate Winslet      | The Reader {'Hanna Schmitz'}              | YES      |
| 2007 (80th) | Actress -- Leading Role | Marion Cotillard  | La Vie en Rose {'Edith Piaf'}             | YES      |
| 2006 (79th) | Actress -- Leading Role | Helen Mirren      | The Queen {'The Queen'}                   | YES      |
| 2005 (78th) | Actress -- Leading Role | Reese Witherspoon | Walk the Line {'June Carter'}             | YES      |
| 2004 (77th) | Actress -- Leading Role | Hilary Swank      | Million Dollar Baby {'Maggie Fitzgerald'} | YES      |
| 2003 (76th) | Actress -- Leading Role | Charlize Theron   | Monster {'Aileen Wuornos'}                | YES      |
| 2002 (75th) | Actress -- Leading Role | Nicole Kidman     | The Hours {'Virginia Woolf'}              | YES      |
| 2001 (74th) | Actress -- Leading Role | Halle Berry       | Monster's Ball {'Leticia Musgrove'}       | YES      |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
| Year        | Category              | Nominee                | Movie                                    | Winner   |
|:------------|:----------------------|:-----------------------|:-----------------------------------------|:---------|
| 2010 (83rd) | Actor -- Leading Role | Colin Firth            | The King's Speech {'King George VI'}     | YES      |
| 2009 (82nd) | Actor -- Leading Role | Jeff Bridges           | Crazy Heart {'Bad Blake'}                | YES      |
| 2008 (81st) | Actor -- Leading Role | Sean Penn              | Milk {'Harvey Milk'}                     | YES      |
| 2007 (80th) | Actor -- Leading Role | Daniel Day-Lewis       | There Will Be Blood {'Daniel Plainview'} | YES      |
| 2006 (79th) | Actor -- Leading Role | Forest Whitaker        | The Last King of Scotland {'Idi Amin'}   | YES      |
| 2005 (78th) | Actor -- Leading Role | Philip Seymour Hoffman | Capote {'Truman Capote'}                 | YES      |
| 2004 (77th) | Actor -- Leading Role | Jamie Foxx             | Ray {'Ray Charles'}                      | YES      |
| 2003 (76th) | Actor -- Leading Role | Sean Penn              | Mystic River {'Jimmy Markum'}            | YES      |
| 2002 (75th) | Actor -- Leading Role | Adrien Brody           | The Pianist {'Wladyslaw Szpilman'}       | YES      |
| 2001 (74th) | Actor -- Leading Role | Denzel Washington      | Training Day {'Alonzo'}                  | YES      |


Table #3
Filename: source_2.csv
Sample Rows in Markdown:
| Year        | Category                 | Nominee         | Movie                                           | Winner   |
|:------------|:-------------------------|:----------------|:------------------------------------------------|:---------|
| 2010 (83rd) | Actor -- Supporting Role | Christian Bale  | The Fighter {'Dicky Eklund'}                    | YES      |
| 2009 (82nd) | Actor -- Supporting Role | Christoph Waltz | Inglourious Basterds {'Col. Hans Landa'}        | YES      |
| 2008 (81st) | Actor -- Supporting Role | Heath Ledger    | The Dark Knight {'Joker'}                       | YES      |
| 2007 (80th) | Actor -- Supporting Role | Javier Bardem   | No Country for Old Men {'Anton Chigurh'}        | YES      |
| 2006 (79th) | Actor -- Supporting Role | Alan Arkin      | Little Miss Sunshine {'Grandpa'}                | YES      |
| 2005 (78th) | Actor -- Supporting Role | George Clooney  | Syriana {'Bob Barnes'}                          | YES      |
| 2004 (77th) | Actor -- Supporting Role | Morgan Freeman  | Million Dollar Baby {'Eddie Scrap-Iron Dupris'} | YES      |
| 2003 (76th) | Actor -- Supporting Role | Tim Robbins     | Mystic River {'Dave Boyle'}                     | YES      |
| 2002 (75th) | Actor -- Supporting Role | Chris Cooper    | Adaptation {'John Laroche'}                     | YES      |
| 2001 (74th) | Actor -- Supporting Role | Jim Broadbent   | Iris {'John Bayley'}                            | YES      |


Table #4
Filename: source_3.csv
Sample Rows in Markdown:
| Year        | Category   | Nominee               | Movie                       | Winner   |
|:------------|:-----------|:----------------------|:----------------------------|:---------|
| 1968 (41st) | Directing  | Oliver!               | Carol Reed                  | YES      |
| 1967 (40th) | Directing  | The Graduate          | Mike Nichols                | YES      |
| 1966 (39th) | Directing  | A Man for All Seasons | Fred Zinnemann              | YES      |
| 1965 (38th) | Directing  | The Sound of Music    | Robert Wise                 | YES      |
| 1964 (37th) | Directing  | My Fair Lady          | George Cukor                | YES      |
| 1963 (36th) | Directing  | Tom Jones             | Tony Richardson             | YES      |
| 1962 (35th) | Directing  | Lawrence of Arabia    | David Lean                  | YES      |
| 1961 (34th) | Directing  | West Side Story       | Robert Wise, Jerome Robbins | YES      |
| 1960 (33rd) | Directing  | The Apartment         | Billy Wilder                | YES      |
| 1959 (32nd) | Directing  | Ben-Hur               | William Wyler               | YES      |


Table #5
Filename: source_4.csv
Sample Rows in Markdown:
| Year        | Category                   | Nominee              | Movie                                                    | Winner   |
|:------------|:---------------------------|:---------------------|:---------------------------------------------------------|:---------|
| 2010 (83rd) | Actress -- Supporting Role | Melissa Leo          | The Fighter {'Alice Ward'}                               | YES      |
| 2009 (82nd) | Actress -- Supporting Role | Mo'Nique             | Precious: Based on the Novel 'Push' by Sapphire {'Mary'} | YES      |
| 2008 (81st) | Actress -- Supporting Role | Penélope Cruz        | Vicky Cristina Barcelona {'Maria Elena'}                 | YES      |
| 2007 (80th) | Actress -- Supporting Role | Tilda Swinton        | Michael Clayton {'Karen Crowder'}                        | YES      |
| 2006 (79th) | Actress -- Supporting Role | Jennifer Hudson      | Dreamgirls {'Effie White'}                               | YES      |
| 2005 (78th) | Actress -- Supporting Role | Rachel Weisz         | The Constant Gardener {'Tessa Quayle'}                   | YES      |
| 2004 (77th) | Actress -- Supporting Role | Cate Blanchett       | The Aviator {'Katharine Hepburn'}                        | YES      |
| 2003 (76th) | Actress -- Supporting Role | Renée Zellweger      | Cold Mountain {'Ruby Thewes'}                            | YES      |
| 2002 (75th) | Actress -- Supporting Role | Catherine Zeta-Jones | Chicago {'Velma Kelly'}                                  | YES      |
| 2001 (74th) | Actress -- Supporting Role | Jennifer Connelly    | A Beautiful Mind {'Alicia Nash'}                         | YES      |


Target Schema:
| Category                   |   Year |   Nominee |   Movie |   Winner |
|:---------------------------|-------:|----------:|--------:|---------:|
| Actor -- Leading Role      |     85 |        85 |      84 |       85 |
| Actor -- Supporting Role   |     75 |        75 |      75 |       75 |
| Actress -- Leading Role    |     84 |        84 |      84 |       84 |
| Actress -- Supporting Role |     75 |        75 |      75 |       75 |
| Directing                  |     42 |        42 |      42 |       42 |

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
source_3.csv
source_4.csv
test: test_0.csv
test_1.csv
test_2.csv
test_3.csv
test_4.csv