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:
| project      | access     | agent   | granularity   |   timestamp |      views |
|:-------------|:-----------|:--------|:--------------|------------:|-----------:|
| en.wikipedia | all-access | user    | monthly       |  2015070100 | 7665421980 |
| en.wikipedia | all-access | user    | monthly       |  2015080100 | 7634815221 |
| en.wikipedia | all-access | user    | monthly       |  2015090100 | 7655695037 |
| en.wikipedia | all-access | user    | monthly       |  2015100100 | 7746031887 |
| en.wikipedia | all-access | user    | monthly       |  2015110100 | 7524321290 |
| en.wikipedia | all-access | user    | monthly       |  2015120100 | 7476287344 |
| en.wikipedia | all-access | user    | monthly       |  2016010100 | 8154016303 |
| en.wikipedia | all-access | user    | monthly       |  2016020100 | 7585859457 |
| en.wikipedia | all-access | user    | monthly       |  2016030100 | 7673274617 |
| en.wikipedia | all-access | user    | monthly       |  2016040100 | 7408147859 |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
| project      | access   | agent   | granularity   |   timestamp |      views |
|:-------------|:---------|:--------|:--------------|------------:|-----------:|
| en.wikipedia | desktop  | user    | monthly       |  2015070100 | 4376666686 |
| en.wikipedia | desktop  | user    | monthly       |  2015080100 | 4332482183 |
| en.wikipedia | desktop  | user    | monthly       |  2015090100 | 4485491704 |
| en.wikipedia | desktop  | user    | monthly       |  2015100100 | 4477532755 |
| en.wikipedia | desktop  | user    | monthly       |  2015110100 | 4287720220 |
| en.wikipedia | desktop  | user    | monthly       |  2015120100 | 4100012037 |
| en.wikipedia | desktop  | user    | monthly       |  2016010100 | 4436179457 |
| en.wikipedia | desktop  | user    | monthly       |  2016020100 | 4250997185 |
| en.wikipedia | desktop  | user    | monthly       |  2016030100 | 4286590426 |
| en.wikipedia | desktop  | user    | monthly       |  2016040100 | 4149383857 |


Table #3
Filename: source_2.csv
Sample Rows in Markdown:
| project      | access-site   | granularity   |   timestamp |      count |
|:-------------|:--------------|:--------------|------------:|-----------:|
| en.wikipedia | mobile-site   | monthly       |  2014100100 | 3091546685 |
| en.wikipedia | mobile-site   | monthly       |  2014110100 | 3027489668 |
| en.wikipedia | mobile-site   | monthly       |  2014120100 | 3278950021 |
| en.wikipedia | mobile-site   | monthly       |  2015010100 | 3485302091 |
| en.wikipedia | mobile-site   | monthly       |  2015020100 | 3091534479 |
| en.wikipedia | mobile-site   | monthly       |  2015030100 | 3330832588 |
| en.wikipedia | mobile-site   | monthly       |  2015040100 | 3222089917 |
| en.wikipedia | mobile-site   | monthly       |  2015050100 | 3334069483 |
| en.wikipedia | mobile-site   | monthly       |  2015060100 | 3038162463 |
| en.wikipedia | mobile-site   | monthly       |  2015070100 | 3254472695 |


Table #4
Filename: source_3.csv
Sample Rows in Markdown:
| project      | access-site   | granularity   |   timestamp |      count |
|:-------------|:--------------|:--------------|------------:|-----------:|
| en.wikipedia | all-sites     | monthly       |  2012050100 | 7784479302 |
| en.wikipedia | all-sites     | monthly       |  2012060100 | 7524265988 |
| en.wikipedia | all-sites     | monthly       |  2012070100 | 7819376527 |
| en.wikipedia | all-sites     | monthly       |  2012080100 | 7885641059 |
| en.wikipedia | all-sites     | monthly       |  2012090100 | 7913689733 |
| en.wikipedia | all-sites     | monthly       |  2012100100 | 8379960050 |
| en.wikipedia | all-sites     | monthly       |  2012110100 | 8219987195 |
| en.wikipedia | all-sites     | monthly       |  2012120100 | 8033826900 |
| en.wikipedia | all-sites     | monthly       |  2013010100 | 9126210673 |
| en.wikipedia | all-sites     | monthly       |  2013020100 | 8100597857 |


Table #5
Filename: source_4.csv
Sample Rows in Markdown:
| project      | access-site   | granularity   |   timestamp |      count |
|:-------------|:--------------|:--------------|------------:|-----------:|
| en.wikipedia | desktop-site  | monthly       |  2008010100 | 4930902570 |
| en.wikipedia | desktop-site  | monthly       |  2008020100 | 4818393763 |
| en.wikipedia | desktop-site  | monthly       |  2008030100 | 4955405809 |
| en.wikipedia | desktop-site  | monthly       |  2008040100 | 5159162183 |
| en.wikipedia | desktop-site  | monthly       |  2008050100 | 5584691092 |
| en.wikipedia | desktop-site  | monthly       |  2008060100 | 5712104279 |
| en.wikipedia | desktop-site  | monthly       |  2008070100 | 5306302874 |
| en.wikipedia | desktop-site  | monthly       |  2008080100 | 5140155519 |
| en.wikipedia | desktop-site  | monthly       |  2008090100 | 5479533823 |
| en.wikipedia | desktop-site  | monthly       |  2008100100 | 5679440782 |


Table #6
Filename: source_5.csv
Sample Rows in Markdown:
| project      | access     | agent   | granularity   |   timestamp |     views |
|:-------------|:-----------|:--------|:--------------|------------:|----------:|
| en.wikipedia | mobile-app | user    | monthly       |  2015070100 | 109624146 |
| en.wikipedia | mobile-app | user    | monthly       |  2015080100 | 109669149 |
| en.wikipedia | mobile-app | user    | monthly       |  2015090100 |  96221684 |
| en.wikipedia | mobile-app | user    | monthly       |  2015100100 |  94523777 |
| en.wikipedia | mobile-app | user    | monthly       |  2015110100 |  94353925 |
| en.wikipedia | mobile-app | user    | monthly       |  2015120100 |  99438956 |
| en.wikipedia | mobile-app | user    | monthly       |  2016010100 | 106432767 |
| en.wikipedia | mobile-app | user    | monthly       |  2016020100 |  92414130 |
| en.wikipedia | mobile-app | user    | monthly       |  2016030100 |  97899074 |
| en.wikipedia | mobile-app | user    | monthly       |  2016040100 |  81719003 |


Table #7
Filename: source_6.csv
Sample Rows in Markdown:
| project      | access     | agent   | granularity   |   timestamp |      views |
|:-------------|:-----------|:--------|:--------------|------------:|-----------:|
| en.wikipedia | mobile-web | user    | monthly       |  2015070100 | 3179131148 |
| en.wikipedia | mobile-web | user    | monthly       |  2015080100 | 3192663889 |
| en.wikipedia | mobile-web | user    | monthly       |  2015090100 | 3073981649 |
| en.wikipedia | mobile-web | user    | monthly       |  2015100100 | 3173975355 |
| en.wikipedia | mobile-web | user    | monthly       |  2015110100 | 3142247145 |
| en.wikipedia | mobile-web | user    | monthly       |  2015120100 | 3276836351 |
| en.wikipedia | mobile-web | user    | monthly       |  2016010100 | 3611404079 |
| en.wikipedia | mobile-web | user    | monthly       |  2016020100 | 3242448142 |
| en.wikipedia | mobile-web | user    | monthly       |  2016030100 | 3288785117 |
| en.wikipedia | mobile-web | user    | monthly       |  2016040100 | 3177044999 |


Target Schema:
| project      | access-site   | granularity   |   timestamp |      views | access   | agent   |
|:-------------|:--------------|:--------------|------------:|-----------:|:---------|:--------|
| en.wikipedia | all-sites     | monthly       |  2008010100 | 4930902570 |          |         |
| en.wikipedia | all-sites     | monthly       |  2008020100 | 4818393763 |          |         |
| en.wikipedia | all-sites     | monthly       |  2008030100 | 4955405809 |          |         |
| en.wikipedia | all-sites     | monthly       |  2008040100 | 5159162183 |          |         |
| en.wikipedia | all-sites     | monthly       |  2008050100 | 5584691092 |          |         |
| en.wikipedia | all-sites     | monthly       |  2008060100 | 5712104279 |          |         |
| en.wikipedia | all-sites     | monthly       |  2008070100 | 5306302874 |          |         |
| en.wikipedia | all-sites     | monthly       |  2008080100 | 5140155519 |          |         |
| en.wikipedia | all-sites     | monthly       |  2008090100 | 5479533823 |          |         |
| en.wikipedia | all-sites     | monthly       |  2008100100 | 5679440782 |          |         |

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