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:
|   RegionID | Region   | Provincia   | Comuna    |   Superficie |   Poblacion |   Densidad |   IDH_2005 |
|-----------:|:---------|:------------|:----------|-------------:|------------:|-----------:|-----------:|
|          9 | Maule    | Talca       | Empedrado |          565 |        4250 |        7.4 |      0.637 |
|          9 | Maule    | Curicó      | Hualañé   |          629 |        9977 |       15.4 |      0.631 |
|          9 | Maule    | Curicó      | Licantén  |          273 |        6689 |       25.2 |      0.705 |
|          9 | Maule    | Linares     | Linares   |         1466 |      107311 |       73.1 |      0.71  |
|          9 | Maule    | Linares     | Longaví   |         1454 |       28968 |       19.3 |      0.626 |
|          9 | Maule    | Talca       | Maule     |          190 |       21957 |       88.6 |      0.681 |
|          9 | Maule    | Curicó      | Molina    |         1552 |       40329 |       25.8 |      0.663 |
|          9 | Maule    | Linares     | Parral    |         1638 |       39404 |       23.2 |      0.656 |
|          9 | Maule    | Talca       | Pelarco   |          332 |        7959 |       21.8 |      0.653 |
|          9 | Maule    | Cauquenes   | Pelluhue  |          371 |        6636 |       17.2 |      0.694 |


Target Schema:
| Region                                |   Poblacion |   Superficie |
|:--------------------------------------|------------:|-------------:|
| Antofagasta                           |      551627 |     126049   |
| Arica y Parinacota                    |      308271 |      17446.2 |
| Atacama                               |      292054 |      74806.3 |
| Coquimbo                              |      714856 |      40967.8 |
| Libertador General Bernardo O'Higgins |      903248 |      16583.3 |
| Maule                                 |      298073 |       9391.8 |
| Metropolitana de Santiago             |     7150480 |      15547   |
| Tarapacá                              |      205566 |      41632.6 |
| Valparaíso                            |     1859312 |      12646.3 |

Return only the final code in markdown codeblock format, without any additional text or explanation. 



target: target.csv
train: source_0.csv
test: test_0.csv