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:
| nombre                                                |   n_concursados |   n_aprobados |   año |
|:------------------------------------------------------|----------------:|--------------:|------:|
| UNIVERSIDAD ARTURO PRAT                               |               4 |             3 |  2013 |
| UNIVERSIDAD ACADEMIA DE HUMANISMO CRISTIANO           |               5 |             2 |  2013 |
| UNIVERSIDAD DE LA SERENA                              |               4 |             2 |  2013 |
| UNIVERSIDAD METROPOLITANA DE CIENCIAS DE LA EDUCACIÓN |               3 |             2 |  2013 |
| UNIVERSIDAD ARTES Y CIENCIAS SOCIALES                 |               8 |             1 |  2013 |
| UNIVERSIDAD CATÓLICA DE TEMUCO                        |               8 |             1 |  2013 |
| UNIVERSIDAD CATÓLICA CARDENAL SILVA HENRIQUEZ         |               3 |             1 |  2013 |
| UNIVERSIDAD DE MAGALLANES                             |               3 |             1 |  2013 |
| UNIVERSIDAD AUTÓNOMA DE CHILE                         |               1 |             1 |  2013 |
| UNIVERSIDAD BERNARDO O'HIGGINS                        |               1 |             1 |  2013 |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
| nombre                             |   n_concursados |   n_aprobados |   año |
|:-----------------------------------|----------------:|--------------:|------:|
| PONT. UNIV. CATOLICA DE CHILE      |             268 |           113 |  2016 |
| UNIV. DE CHILE                     |             338 |           109 |  2016 |
| UNIV. DE CONCEPCION                |             144 |            43 |  2016 |
| PONT. UNIV. CATOLICA DE VALPARAISO |              91 |            27 |  2016 |
| UNIV. DE SANTIAGO DE CHILE         |              92 |            27 |  2016 |
| UNIV. AUSTRAL DE CHILE             |              71 |            21 |  2016 |
| UNIV. ANDRES BELLO                 |              60 |            20 |  2016 |
| UNIV. TECNICA FEDERICO SANTA MARIA |              63 |            19 |  2016 |
| UNIV. DE TALCA                     |              55 |            17 |  2016 |
| UNIV. DE VALPARAISO                |              41 |            13 |  2016 |


Table #3
Filename: source_2.csv
Sample Rows in Markdown:
| nombre                             |   n_concursados |   n_aprobados |   año |
|:-----------------------------------|----------------:|--------------:|------:|
| UNIV. DE CHILE                     |             219 |           130 |  2011 |
| PONT. UNIV. CATOLICA DE CHILE      |             160 |           103 |  2011 |
| UNIV. DE CONCEPCION                |              93 |            45 |  2011 |
| UNIV. DE SANTIAGO DE CHILE         |              66 |            31 |  2011 |
| PONT. UNIV. CATOLICA DE VALPARAISO |              54 |            27 |  2011 |
| UNIV. AUSTRAL DE CHILE             |              47 |            24 |  2011 |
| UNIV. TECNICA FEDERICO SANTA MARIA |              28 |            17 |  2011 |
| UNIV. DE TALCA                     |              33 |            15 |  2011 |
| UNIV. CATOLICA DEL NORTE           |              24 |             9 |  2011 |
| UNIV. DE VALPARAISO                |              24 |             8 |  2011 |


Table #4
Filename: source_3.csv
Sample Rows in Markdown:
| nombre                             |   n_concursados |   n_aprobados |   año |
|:-----------------------------------|----------------:|--------------:|------:|
| UNIV. DE CHILE                     |             253 |           125 |  2014 |
| PONT. UNIV. CATOLICA DE CHILE      |             202 |           118 |  2014 |
| UNIV. DE CONCEPCION                |             108 |            46 |  2014 |
| UNIV. DE SANTIAGO DE CHILE         |              74 |            33 |  2014 |
| PONT. UNIV. CATOLICA DE VALPARAISO |              69 |            31 |  2014 |
| UNIV. AUSTRAL DE CHILE             |              49 |            22 |  2014 |
| UNIV. DIEGO PORTALES               |              41 |            21 |  2014 |
| UNIV. ANDRES BELLO                 |              36 |            19 |  2014 |
| UNIV. TECNICA FEDERICO SANTA MARIA |              36 |            19 |  2014 |
| UNIV. ALBERTO HURTADO              |              22 |            16 |  2014 |


Table #5
Filename: source_4.csv
Sample Rows in Markdown:
| nombre                             |   n_concursados |   n_aprobados |   año |
|:-----------------------------------|----------------:|--------------:|------:|
| UNIV. DE CHILE                     |             289 |           123 |  2015 |
| PONT. UNIV. CATOLICA DE CHILE      |             225 |           108 |  2015 |
| UNIV. DE CONCEPCION                |             112 |            46 |  2015 |
| PONT. UNIV. CATOLICA DE VALPARAISO |              70 |            33 |  2015 |
| UNIV. TECNICA FEDERICO SANTA MARIA |              50 |            24 |  2015 |
| UNIV. DE SANTIAGO DE CHILE         |              77 |            31 |  2015 |
| UNIV. AUSTRAL DE CHILE             |              68 |            30 |  2015 |
| UNIV. CATOLICA DEL NORTE           |              37 |            10 |  2015 |
| UNIV. DE VALPARAISO                |              33 |             9 |  2015 |
| UNIV. DE ANTOFAGASTA               |              14 |             2 |  2015 |


Table #6
Filename: source_5.csv
Sample Rows in Markdown:
| nombre                             |   n_concursados |   n_aprobados |   año |
|:-----------------------------------|----------------:|--------------:|------:|
| UNIV. DE CHILE                     |             204 |            86 |  2010 |
| PONT. UNIV. CATOLICA DE CHILE      |             180 |           100 |  2010 |
| UNIV. DE CONCEPCION                |              95 |            41 |  2010 |
| UNIV. AUSTRAL DE CHILE             |              48 |            25 |  2010 |
| UNIV. DE SANTIAGO DE CHILE         |              62 |            21 |  2010 |
| UNIV. TECNICA FEDERICO SANTA MARIA |              37 |            19 |  2010 |
| PONT. UNIV. CATOLICA DE VALPARAISO |              53 |            13 |  2010 |
| UNIV. DE LA FRONTERA               |              20 |            12 |  2010 |
| UNIV. ANDRES BELLO                 |              22 |             8 |  2010 |
| UNIV. CATOLICA DEL NORTE           |              22 |             9 |  2010 |


Table #7
Filename: source_6.csv
Sample Rows in Markdown:
| nombre                             |   n_concursados |   n_aprobados |   año |
|:-----------------------------------|----------------:|--------------:|------:|
| UNIV. DE CHILE                     |             251 |           152 |  2012 |
| PONT. UNIV. CATOLICA DE CHILE      |             142 |            89 |  2012 |
| UNIV. DE CONCEPCION                |              97 |            48 |  2012 |
| UNIV. AUSTRAL DE CHILE             |              44 |            32 |  2012 |
| UNIV. DE SANTIAGO DE CHILE         |              84 |            39 |  2012 |
| PONT. UNIV. CATOLICA DE VALPARAISO |              56 |            30 |  2012 |
| UNIV. ANDRES BELLO                 |              25 |            14 |  2012 |
| UNIV. DE LA FRONTERA               |              26 |            18 |  2012 |
| UNIV. TECNICA FEDERICO SANTA MARIA |              39 |            23 |  2012 |
| UNIV. DE VALPARAISO                |              27 |            15 |  2012 |


Target Schema:
| nombre                             |   n_concursados |   n_aprobados |   año |
|:-----------------------------------|----------------:|--------------:|------:|
| UNIV. DE CHILE                     |             204 |            86 |  2010 |
| PONT. UNIV. CATOLICA DE CHILE      |             180 |           100 |  2010 |
| UNIV. DE CONCEPCION                |              95 |            41 |  2010 |
| UNIV. AUSTRAL DE CHILE             |              48 |            25 |  2010 |
| UNIV. DE SANTIAGO DE CHILE         |              62 |            21 |  2010 |
| UNIV. TECNICA FEDERICO SANTA MARIA |              37 |            19 |  2010 |
| PONT. UNIV. CATOLICA DE VALPARAISO |              53 |            13 |  2010 |
| UNIV. DE LA FRONTERA               |              20 |            12 |  2010 |
| UNIV. ANDRES BELLO                 |              22 |             8 |  2010 |
| UNIV. CATOLICA DEL NORTE           |              22 |             9 |  2010 |

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
test: test_0.csv
test_1.csv
test_2.csv
test_3.csv
test_4.csv
test_5.csv
test_6.csv