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:
| County      | m1403       |
|:------------|:------------|
| Adams       | $477,275    |
| Alamosa     | NR          |
| Arapahoe    | $1,490,219  |
| Archuleta   | NR          |
| Boulder     | $3,505,875  |
| Chaffee     | NR          |
| Clear Creek | $106,955    |
| Costilla    | NR          |
| Denver      | $16,102,218 |
| Eagle       | $201,147    |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
| County     |
|:-----------|
| Kit Carson |
| La Plata   |
| Lake       |
| Larimer    |
| Las Animas |
| Lincoln    |
| Logan      |
| Mesa       |
| Mineral    |
| Moffat     |


Table #3
Filename: source_2.csv
Sample Rows in Markdown:
| County      | m1401       |
|:------------|:------------|
| Adams       | $683,098    |
| Alamosa     | NR          |
| Arapahoe    | $1,188,232  |
| Archuleta   | NR          |
| Boulder     | $3,417,873  |
| Chaffee     | $83,714     |
| Clear Creek | $143,736    |
| Costilla    | NR          |
| Denver      | $15,351,083 |
| Eagle       | $203,060    |


Table #4
Filename: source_3.csv
Sample Rows in Markdown:
| County      | m1402       |
|:------------|:------------|
| Adams       | $454,940    |
| Alamosa     | NR          |
| Arapahoe    | $1,210,155  |
| Archuleta   | NR          |
| Boulder     | $3,345,413  |
| Chaffee     | NR          |
| Clear Creek | $111,164    |
| Costilla    | NR          |
| Denver      | $14,680,476 |
| Eagle       | $185,360    |


Table #5
Filename: source_4.csv
Sample Rows in Markdown:
| County      | m1404       |
|:------------|:------------|
| Adams       | $452,636    |
| Alamosa     | NR          |
| Arapahoe    | $1,517,828  |
| Archuleta   | NR          |
| Boulder     | $3,136,133  |
| Chaffee     | NR          |
| Clear Creek | $92,791     |
| Costilla    | NR          |
| Denver      | $15,064,678 |
| Eagle       | $178,397    |


Target Schema:
| County      | m1401       | m1402       | m1403       | m1404       |
|:------------|:------------|:------------|:------------|:------------|
| Adams       | $683,098    | $454,940    | $477,275    | $452,636    |
| Alamosa     | NR          | NR          | NR          | NR          |
| Arapahoe    | $1,188,232  | $1,210,155  | $1,490,219  | $1,517,828  |
| Archuleta   | NR          | NR          | NR          | NR          |
| Boulder     | $3,417,873  | $3,345,413  | $3,505,875  | $3,136,133  |
| Chaffee     | $83,714     | NR          | NR          | NR          |
| Clear Creek | $143,736    | $111,164    | $106,955    | $92,791     |
| Costilla    | NR          | NR          | NR          | NR          |
| Denver      | $15,351,083 | $14,680,476 | $16,102,218 | $15,064,678 |
| Eagle       | $203,060    | $185,360    | $201,147    | $178,397    |

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