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:
| country    |   beer_servings |   spirit_servings |   wine_servings |   total_litres_of_pure_alcohol | continent   |
|:-----------|----------------:|------------------:|----------------:|-------------------------------:|:------------|
| Liberia    |              19 |               152 |               2 |                            3.1 | AF          |
| Libya      |               0 |                 0 |               0 |                            0   | AF          |
| Lithuania  |             343 |               244 |              56 |                           12.9 | EU          |
| Luxembourg |             236 |               133 |             271 |                           11.4 | EU          |
| Madagascar |              26 |                15 |               4 |                            0.8 | AF          |
| Malawi     |               8 |                11 |               1 |                            1.5 | AF          |
| Malaysia   |              13 |                 4 |               0 |                            0.3 | AS          |
| Maldives   |               0 |                 0 |               0 |                            0   | AS          |
| Mali       |               5 |                 1 |               1 |                            0.6 | AF          |
| Malta      |             149 |               100 |             120 |                            6.6 | EU          |


Target Schema:
| continent   |   beer_servings |   spirit_servings |   wine_servings |   total_litres_of_pure_alcohol |
|:------------|----------------:|------------------:|----------------:|-------------------------------:|
| AF          |         67.1154 |           15.5769 |         18.6923 |                        2.78846 |
| AS          |         31.9    |           56.5    |         10.75   |                        2       |
| EU          |        195.708  |          141.792  |        145.958  |                        8.9625  |
| OC          |         89.75   |           98.75   |         72      |                        4.825   |
| SA          |        164.143  |          112.429  |         60.5714 |                        6.05714 |

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