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:
|   Rank |   Code | Description                                            |      x(t) |
|-------:|-------:|:-------------------------------------------------------|----------:|
|      1 |  10397 | Atlanta, GA: Hartsfield-Jackson Atlanta International  | 0.0373843 |
|      2 |  13930 | Chicago, IL: Chicago O'Hare International              | 0.0360425 |
|      3 |  11292 | Denver, CO: Denver International                       | 0.0312138 |
|      4 |  13487 | Minneapolis, MN: Minneapolis-St Paul International     | 0.0267613 |
|      5 |  12266 | Houston, TX: George Bush Intercontinental/Houston      | 0.0248094 |
|      6 |  11298 | Dallas/Fort Worth, TX: Dallas/Fort Worth International | 0.0245874 |
|      7 |  11433 | Detroit, MI: Detroit Metro Wayne County                | 0.0244825 |
|      8 |  14107 | Phoenix, AZ: Phoenix Sky Harbor International          | 0.0210183 |
|      9 |  14869 | Salt Lake City, UT: Salt Lake City International       | 0.0200368 |
|     10 |  11618 | Newark, NJ: Newark Liberty International               | 0.0195438 |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
|   Code | Description                                    |
|-------:|:-----------------------------------------------|
|  10001 | Afognak Lake, AK: Afognak Lake Airport         |
|  10003 | Granite Mountain, AK: Bear Creek Mining Strip  |
|  10004 | Lik, AK: Lik Mining Camp                       |
|  10005 | Little Squaw, AK: Little Squaw Airport         |
|  10006 | Kizhuyak, AK: Kizhuyak Bay                     |
|  10007 | Klawock, AK: Klawock Seaplane Base             |
|  10008 | Elizabeth Island, AK: Elizabeth Island Airport |
|  10009 | Homer, AK: Augustin Island                     |
|  10010 | Hudson, NY: Columbia County                    |
|  10011 | Peach Springs, AZ: Grand Canyon West           |


Table #3
Filename: source_2.csv
Sample Rows in Markdown:
| FL_DATE    | UNIQUE_CARRIER   |   FL_NUM |   ORIGIN_AIRPORT_ID |   ORIGIN_CITY_MARKET_ID |   DEST_AIRPORT_ID |   DEST_CITY_MARKET_ID |
|:-----------|:-----------------|---------:|--------------------:|------------------------:|------------------:|----------------------:|
| 2017-08-26 | B6               |     1827 |               11618 |                   31703 |             13204 |                 31454 |
| 2017-08-26 | EV               |     4452 |               12266 |                   31453 |             15624 |                 31504 |
| 2017-08-21 | UA               |     1887 |               11292 |                   30325 |             10529 |                 30529 |
| 2017-08-28 | UA               |      310 |               13930 |                   30977 |             12892 |                 32575 |
| 2017-08-29 | DL               |     2237 |               12478 |                   31703 |             10397 |                 30397 |
| 2017-08-20 | WN               |     4212 |               13204 |                   31454 |             10821 |                 30852 |
| 2017-08-27 | UA               |      618 |               14771 |                   32457 |             14747 |                 30559 |
| 2017-08-28 | AA               |      360 |               11298 |                   30194 |             12339 |                 32337 |
| 2017-08-19 | DL               |     1613 |               12339 |                   32337 |             10397 |                 30397 |
| 2017-08-29 | AS               |      699 |               11884 |                   31884 |             14747 |                 30559 |


Target Schema:
|   Code |   Rank | Description_x                                          | Description_y                                          |
|-------:|-------:|:-------------------------------------------------------|:-------------------------------------------------------|
|  10397 |      1 | Atlanta, GA: Hartsfield-Jackson Atlanta International  | Atlanta, GA: Hartsfield-Jackson Atlanta International  |
|  13930 |      2 | Chicago, IL: Chicago O'Hare International              | Chicago, IL: Chicago O'Hare International              |
|  11292 |      3 | Denver, CO: Denver International                       | Denver, CO: Denver International                       |
|  13487 |      4 | Minneapolis, MN: Minneapolis-St Paul International     | Minneapolis, MN: Minneapolis-St Paul International     |
|  12266 |      5 | Houston, TX: George Bush Intercontinental/Houston      | Houston, TX: George Bush Intercontinental/Houston      |
|  11298 |      6 | Dallas/Fort Worth, TX: Dallas/Fort Worth International | Dallas/Fort Worth, TX: Dallas/Fort Worth International |
|  11433 |      7 | Detroit, MI: Detroit Metro Wayne County                | Detroit, MI: Detroit Metro Wayne County                |
|  14107 |      8 | Phoenix, AZ: Phoenix Sky Harbor International          | Phoenix, AZ: Phoenix Sky Harbor International          |
|  14869 |      9 | Salt Lake City, UT: Salt Lake City International       | Salt Lake City, UT: Salt Lake City International       |
|  11618 |     10 | Newark, NJ: Newark Liberty International               | Newark, NJ: Newark Liberty International               |

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