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:
| TechType   |   HighSpeed |   population | state   |
|:-----------|------------:|-------------:|:--------|
| Other      |           1 |         1021 | MO      |
| DOCSIS     |           0 |        21992 | MT      |
| DOCSIS     |           1 |       623142 | MT      |
| DSL        |           0 |       876618 | MT      |
| DSL        |           1 |        32971 | MT      |
| FTTH       |           0 |        39936 | MT      |
| FTTH       |           1 |       107814 | MT      |
| Other      |           0 |       733980 | MT      |
| Other      |           1 |          252 | MT      |
| DOCSIS     |           0 |        72513 | NE      |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
|   Broadband Initiative |   Federal |   Percent | state   |
|-----------------------:|----------:|----------:|:--------|
|                4874142 |  91596026 |       2.6 | AL      |
|                6378198 |         0 |       0   | AK      |
|                6358179 |         0 |       0   | AZ      |
|                6175366 | 102131393 |       2.9 | AR      |
|                7981304 | 350064330 |      10   | CA      |
|                5382082 | 112772612 |       3.2 | CO      |
|                3782938 |  93855029 |       2.7 | CT      |
|                3080450 |         0 |       0   | DE      |
|                8877028 |  55902591 |       1.6 | FL      |
|                5229940 |  69687765 |       2   | GA      |


Target Schema:
|   Broadband Initiative |   Federal |   Percent | state   |   population |
|-----------------------:|----------:|----------:|:--------|-------------:|
|                4874142 |  91596026 |       2.6 | AL      |     10915751 |
|                6378198 |         0 |       0   | AK      |      1517903 |
|                6358179 |         0 |       0   | AZ      |     17543910 |
|                6175366 | 102131393 |       2.9 | AR      |      5910240 |
|                7981304 | 350064330 |      10   | CA      |     95401525 |
|                5382082 | 112772612 |       3.2 | CO      |     14280585 |
|                3782938 |  93855029 |       2.7 | CT      |      7070725 |
|                3080450 |         0 |       0   | DE      |      2178181 |
|                8877028 |  55902591 |       1.6 | FL      |     48433349 |
|                5229940 |  69687765 |       2   | GA      |     21906565 |

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
test: test_0.csv
test_1.csv