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        |                 9.3 |
| ALABAMA              |                11   |
| ALASKA               |                 7.7 |
| ARIZONA              |                 9.9 |
| ARKANSAS             |                 7.8 |
| CALIFORNIA           |                11.2 |
| COLORADO             |                 7.3 |
| CONNECTICUT          |                 7.9 |
| DELAWARE             |                 8.3 |
| DISTRICT OF COLUMBIA |                 9.3 |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
| States               |   2009 |
|:---------------------|-------:|
| UNITED STATES        |  49777 |
| ALABAMA              |  39980 |
| ALASKA               |  61604 |
| ARIZONA              |  45739 |
| ARKANSAS             |  36538 |
| CALIFORNIA           |  56134 |
| COLORADO             |  55930 |
| CONNECTICUT          |  64851 |
| DELAWARE             |  52114 |
| DISTRICT OF COLUMBIA |  53141 |


Table #3
Filename: source_2.csv
Sample Rows in Markdown:
| States               |   2010 |
|:---------------------|-------:|
| UNITED STATES        |  49276 |
| ALABAMA              |  40933 |
| ALASKA               |  57848 |
| ARIZONA              |  46896 |
| ARKANSAS             |  38587 |
| CALIFORNIA           |  54283 |
| COLORADO             |  60233 |
| CONNECTICUT          |  65998 |
| DELAWARE             |  55214 |
| DISTRICT OF COLUMBIA |  56928 |


Table #4
Filename: source_3.csv
Sample Rows in Markdown:
| States               |   2009 |
|:---------------------|-------:|
| UNITED STATES        |  49777 |
| ALABAMA              |  39980 |
| ALASKA               |  61604 |
| ARIZONA              |  45739 |
| ARKANSAS             |  36538 |
| CALIFORNIA           |  56134 |
| COLORADO             |  55930 |
| CONNECTICUT          |  64851 |
| DELAWARE             |  52114 |
| DISTRICT OF COLUMBIA |  53141 |


Table #5
Filename: source_4.csv
Sample Rows in Markdown:
| States         |   2008 |
|:---------------|-------:|
| MISSOURI       |  46038 |
| MONTANA        |  42900 |
| NEBRASKA       |  50728 |
| NEVADA         |  54744 |
| NEW HAMPSHIRE  |  66176 |
| NEW JERSEY     |  65306 |
| NEW MEXICO     |  42102 |
| NEW YORK       |  50461 |
| NORTH CAROLINA |  42930 |
| NORTH DAKOTA   |  49631 |


Table #6
Filename: source_5.csv
Sample Rows in Markdown:
| States               |   Unemployment Rate |
|:---------------------|--------------------:|
| UNITED STATES        |                 9.6 |
| ALABAMA              |                10.5 |
| ALASKA               |                 7.9 |
| ARIZONA              |                10.4 |
| ARKANSAS             |                 8.2 |
| CALIFORNIA           |                12.2 |
| COLORADO             |                 8.7 |
| CONNECTICUT          |                 9.1 |
| DELAWARE             |                 8.4 |
| DISTRICT OF COLUMBIA |                 9.4 |


Table #7
Filename: source_6.csv
Sample Rows in Markdown:
| States               |   2010 |
|:---------------------|-------:|
| UNITED STATES        |  49276 |
| ALABAMA              |  40933 |
| ALASKA               |  57848 |
| ARIZONA              |  46896 |
| ARKANSAS             |  38587 |
| CALIFORNIA           |  54283 |
| COLORADO             |  60233 |
| CONNECTICUT          |  65998 |
| DELAWARE             |  55214 |
| DISTRICT OF COLUMBIA |  56928 |


Table #8
Filename: source_7.csv
Sample Rows in Markdown:
| States               |   2008 |
|:---------------------|-------:|
| UNITED STATES        |  50303 |
| ALABAMA              |  44476 |
| ALASKA               |  63989 |
| ARIZONA              |  46914 |
| ARKANSAS             |  39586 |
| CALIFORNIA           |  57014 |
| COLORADO             |  60943 |
| CONNECTICUT          |  64682 |
| DELAWARE             |  50702 |
| DISTRICT OF COLUMBIA |  55590 |


Table #9
Filename: source_8.csv
Sample Rows in Markdown:
| States               |   Unemployment Rate |
|:---------------------|--------------------:|
| UNITED STATES        |                 5.8 |
| ALABAMA              |                 5.7 |
| ALASKA               |                 6.7 |
| ARIZONA              |                 6.2 |
| ARKANSAS             |                 5.5 |
| CALIFORNIA           |                 7.3 |
| COLORADO             |                 4.8 |
| CONNECTICUT          |                 5.7 |
| DELAWARE             |                 4.9 |
| DISTRICT OF COLUMBIA |                 6.5 |


Target Schema:
| States               |   2008 |   Unemployment Rate |   2008_3 | 2009_x   | 2009_y   | 2010_x   | 2010_y   |
|:---------------------|-------:|--------------------:|---------:|:---------|:---------|:---------|:---------|
| UNITED STATES        |  50303 |                 5.8 |    50303 |          |          |          |          |
| ALABAMA              |  44476 |                 5.7 |    44476 |          |          |          |          |
| ALASKA               |  63989 |                 6.7 |    63989 |          |          |          |          |
| ARIZONA              |  46914 |                 6.2 |    46914 |          |          |          |          |
| ARKANSAS             |  39586 |                 5.5 |    39586 |          |          |          |          |
| CALIFORNIA           |  57014 |                 7.3 |    57014 |          |          |          |          |
| COLORADO             |  60943 |                 4.8 |    60943 |          |          |          |          |
| CONNECTICUT          |  64682 |                 5.7 |    64682 |          |          |          |          |
| DELAWARE             |  50702 |                 4.9 |    50702 |          |          |          |          |
| DISTRICT OF COLUMBIA |  55590 |                 6.5 |    55590 |          |          |          |          |

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