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:
| States               |   Unemployment Rate |
|:---------------------|--------------------:|
| UNITED STATES        |                 7.4 |
| ALABAMA              |                 7.2 |
| ALASKA               |                 6.9 |
| ARIZONA              |                 7.7 |
| ARKANSAS             |                 7.3 |
| CALIFORNIA           |                 8.9 |
| COLORADO             |                 6.8 |
| CONNECTICUT          |                 7.8 |
| DELAWARE             |                 6.7 |
| DISTRICT OF COLUMBIA |                 8.5 |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
| States               |   2013 |
|:---------------------|-------:|
| UNITED STATES        |  53585 |
| ALABAMA              |  47320 |
| ALASKA               |  72472 |
| ARIZONA              |  52611 |
| ARKANSAS             |  39376 |
| CALIFORNIA           |  60794 |
| COLORADO             |  67912 |
| CONNECTICUT          |  69291 |
| DELAWARE             |  54091 |
| DISTRICT OF COLUMBIA |  60057 |


Table #3
Filename: source_2.csv
Sample Rows in Markdown:
| States               |   2013 |
|:---------------------|-------:|
| UNITED STATES        |  53585 |
| ALABAMA              |  47320 |
| ALASKA               |  72472 |
| ARIZONA              |  52611 |
| ARKANSAS             |  39376 |
| CALIFORNIA           |  60794 |
| COLORADO             |  67912 |
| CONNECTICUT          |  69291 |
| DELAWARE             |  54091 |
| DISTRICT OF COLUMBIA |  60057 |


Table #4
Filename: source_3.csv
Sample Rows in Markdown:
| States               |   Unemployment Rate |
|:---------------------|--------------------:|
| UNITED STATES        |                 8.1 |
| ALABAMA              |                 8   |
| ALASKA               |                 7.1 |
| ARIZONA              |                 8.3 |
| ARKANSAS             |                 7.6 |
| CALIFORNIA           |                10.4 |
| COLORADO             |                 7.9 |
| CONNECTICUT          |                 8.3 |
| DELAWARE             |                 7.2 |
| DISTRICT OF COLUMBIA |                 9   |


Table #5
Filename: source_4.csv
Sample Rows in Markdown:
| States               |   Unemployment Rate |
|:---------------------|--------------------:|
| UNITED STATES        |                 8.9 |
| ALABAMA              |                 9.6 |
| ALASKA               |                 7.6 |
| ARIZONA              |                 9.5 |
| ARKANSAS             |                 8.3 |
| CALIFORNIA           |                11.7 |
| COLORADO             |                 8.4 |
| CONNECTICUT          |                 8.8 |
| DELAWARE             |                 7.5 |
| DISTRICT OF COLUMBIA |                10.2 |


Table #6
Filename: source_5.csv
Sample Rows in Markdown:
| States               |   2012 |
|:---------------------|-------:|
| UNITED STATES        |  51017 |
| ALABAMA              |  43464 |
| ALASKA               |  63648 |
| ARIZONA              |  47044 |
| ARKANSAS             |  39018 |
| CALIFORNIA           |  57020 |
| COLORADO             |  57255 |
| CONNECTICUT          |  64247 |
| DELAWARE             |  48972 |
| DISTRICT OF COLUMBIA |  65246 |


Table #7
Filename: source_6.csv
Sample Rows in Markdown:
| States               |   2012 |
|:---------------------|-------:|
| UNITED STATES        |  51017 |
| ALABAMA              |  43464 |
| ALASKA               |  63648 |
| ARIZONA              |  47044 |
| ARKANSAS             |  39018 |
| CALIFORNIA           |  57020 |
| COLORADO             |  57255 |
| CONNECTICUT          |  64247 |
| DELAWARE             |  48972 |
| DISTRICT OF COLUMBIA |  65246 |


Table #8
Filename: source_7.csv
Sample Rows in Markdown:
| States         |   2011 |
|:---------------|-------:|
| MISSOURI       |  45774 |
| MONTANA        |  40277 |
| NEBRASKA       |  55616 |
| NEVADA         |  47043 |
| NEW HAMPSHIRE  |  65880 |
| NEW JERSEY     |  62338 |
| NEW MEXICO     |  41982 |
| NEW YORK       |  50636 |
| NORTH CAROLINA |  45206 |
| NORTH DAKOTA   |  56361 |


Table #9
Filename: source_8.csv
Sample Rows in Markdown:
| States               |   2011 |
|:---------------------|-------:|
| UNITED STATES        |  50054 |
| ALABAMA              |  42590 |
| ALASKA               |  57431 |
| ARIZONA              |  48621 |
| ARKANSAS             |  41302 |
| CALIFORNIA           |  53367 |
| COLORADO             |  58629 |
| CONNECTICUT          |  65415 |
| DELAWARE             |  54660 |
| DISTRICT OF COLUMBIA |  55251 |


Target Schema:
| States               |   2011 |   Unemployment Rate |   2011_3 | 2012_x   | 2012_y   | 2013_x   | 2013_y   |
|:---------------------|-------:|--------------------:|---------:|:---------|:---------|:---------|:---------|
| UNITED STATES        |  50054 |                 8.9 |    50054 |          |          |          |          |
| ALABAMA              |  42590 |                 9.6 |    42590 |          |          |          |          |
| ALASKA               |  57431 |                 7.6 |    57431 |          |          |          |          |
| ARIZONA              |  48621 |                 9.5 |    48621 |          |          |          |          |
| ARKANSAS             |  41302 |                 8.3 |    41302 |          |          |          |          |
| CALIFORNIA           |  53367 |                11.7 |    53367 |          |          |          |          |
| COLORADO             |  58629 |                 8.4 |    58629 |          |          |          |          |
| CONNECTICUT          |  65415 |                 8.8 |    65415 |          |          |          |          |
| DELAWARE             |  54660 |                 7.5 |    54660 |          |          |          |          |
| DISTRICT OF COLUMBIA |  55251 |                10.2 |    55251 |          |          |          |          |

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
source_5.csv
source_6.csv
source_7.csv
source_8.csv
test: test_0.csv
test_1.csv
test_2.csv
test_3.csv
test_4.csv
test_5.csv
test_6.csv
test_7.csv
test_8.csv