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:
|   danceability |   energy |   key |   speechiness |   acousticness |   instrumentalness |   liveness |   valence |   tempo |   duration_ms |   time_signature | artist_name   | release_date   | song_name                         | song_name_formatted   |
|---------------:|---------:|------:|--------------:|---------------:|-------------------:|-----------:|----------:|--------:|--------------:|-----------------:|:--------------|:---------------|:----------------------------------|:----------------------|
|          0.637 |    0.799 |     2 |        0.0338 |        0.394   |            0       |     0.0921 |     0.562 | 104.995 |        228615 |                4 | BTS           | 2018-08-24     | Euphoria                          | euphoria              |
|          0.723 |    0.906 |     1 |        0.279  |        0.0907  |            0       |     0.0771 |     0.398 | 125.019 |        225221 |                4 | BTS           | 2018-08-24     | Trivia 起 : Just Dance            | trivia-just-dance     |
|          0.347 |    0.578 |     8 |        0.0626 |        0.445   |            0       |     0.231  |     0.226 |  86.73  |        276708 |                5 | BTS           | 2018-08-24     | Serendipity (Full Length Edition) | serendipity-length    |
|          0.599 |    0.774 |     1 |        0.0541 |        0.0223  |            0       |     0.0669 |     0.696 | 129.819 |        223123 |                4 | BTS           | 2018-08-24     | DNA                               | dna                   |
|          0.612 |    0.844 |     5 |        0.0756 |        0.142   |            0       |     0.287  |     0.653 | 134.868 |        196776 |                4 | BTS           | 2018-08-24     | Dimple                            | dimple                |
|          0.761 |    0.761 |     5 |        0.0897 |        0.246   |            0       |     0.103  |     0.483 | 121.972 |        225698 |                4 | BTS           | 2018-08-24     | Trivia 承 : Love                  | trivia-love           |
|          0.481 |    0.927 |     3 |        0.27   |        0.317   |            0       |     0.0583 |     0.448 |  88.931 |        228613 |                4 | BTS           | 2018-08-24     | Her                               | her                   |
|          0.775 |    0.271 |     1 |        0.092  |        0.554   |            0.00285 |     0.112  |     0.204 | 104.001 |        196998 |                3 | BTS           | 2018-08-24     | Singularity                       | singularity           |
|          0.557 |    0.719 |     2 |        0.0372 |        0.00267 |            0       |     0.306  |     0.344 |  77.501 |        242334 |                4 | BTS           | 2018-08-24     | FAKE LOVE                         | fake-love             |
|          0.57  |    0.422 |     1 |        0.0422 |        0.372   |            0       |     0.127  |     0.169 | 113.007 |        242293 |                4 | BTS           | 2018-08-24     | The Truth Untold                  | the-truth-untold      |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
|   danceability |   energy |   key |   speechiness |   acousticness |   instrumentalness |   liveness |   valence |   tempo |   duration_ms |   time_signature | artist_name   | release_date   |
|---------------:|---------:|------:|--------------:|---------------:|-------------------:|-----------:|----------:|--------:|--------------:|-----------------:|:--------------|:---------------|
|          0.734 |    0.77  |     1 |        0.0324 |       0.00307  |           0        |     0.0824 |     0.686 | 104.999 |        253947 |                4 | Lady Gaga     | 2010-01-01     |
|          0.752 |    0.946 |     0 |        0.0802 |       0.0388   |           0.000121 |     0.312  |     0.907 | 127.983 |        221480 |                4 | Lady Gaga     | 2010-01-01     |
|          0.696 |    0.921 |     0 |        0.0363 |       0.00314  |           5.24e-05 |     0.0842 |     0.714 | 119.001 |        294573 |                4 | Lady Gaga     | 2009-01-01     |
|          0.623 |    0.793 |    11 |        0.0462 |       0.000397 |           0.0015   |     0.375  |     0.36  |  98.998 |        274213 |                4 | Lady Gaga     | 2009-01-01     |
|          0.694 |    0.801 |     9 |        0.0441 |       0.00124  |           0        |     0.479  |     0.646 | 119.969 |        249280 |                4 | Lady Gaga     | 2009-01-01     |
|          0.298 |    0.702 |     0 |        0.0398 |       0.441    |           0        |     0.35   |     0.429 | 143.828 |        270813 |                4 | Lady Gaga     | 2009-01-01     |
|          0.639 |    0.751 |     0 |        0.0324 |       2.96e-05 |           4.9e-05  |     0.163  |     0.13  | 120.992 |        288960 |                4 | Lady Gaga     | 2009-01-01     |
|          0.824 |    0.836 |     3 |        0.0404 |       0.00521  |           0.000817 |     0.112  |     0.716 | 122.014 |        220640 |                4 | Lady Gaga     | 2009-01-01     |
|          0.557 |    0.772 |     0 |        0.0304 |       0.000318 |           0.00234  |     0.176  |     0.324 |  99.967 |        234867 |                4 | Lady Gaga     | 2009-01-01     |
|          0.708 |    0.826 |    11 |        0.0476 |       0.0327   |           0        |     0.0868 |     0.519 |  96.019 |        220707 |                4 | Lady Gaga     | 2009-01-01     |


Target Schema:
| artist_name       |   speechiness |   instrumentalness |   danceability |   energy |   acousticness |
|:------------------|--------------:|-------------------:|---------------:|---------:|---------------:|
| *NSYNC            |     0.0580873 |         0.020642   |       0.60669  | 0.676935 |       0.224102 |
| AOA               |     0.0736488 |         0.0980465  |       0.665081 | 0.847846 |       0.159874 |
| BIGBANG           |     0.108219  |         0.00658604 |       0.582627 | 0.8329   |       0.10964  |
| BTS               |     0.172844  |         0.0123996  |       0.601454 | 0.801566 |       0.118142 |
| Backstreet Boys   |     0.0546361 |         0.0110735  |       0.609911 | 0.721334 |       0.138418 |
| GFRIEND           |     0.0544065 |         0.289859   |       0.617545 | 0.719066 |       0.253075 |
| Girls' Generation |     0.0729175 |         0.0523887  |       0.67079  | 0.797883 |       0.228858 |
| Kelly Clarkson    |     0.0821625 |         0.00736278 |       0.551369 | 0.702889 |       0.166611 |
| Lady Gaga         |     0.0978141 |         0.0198586  |       0.59162  | 0.679012 |       0.207624 |
| One Direction     |     0.0492382 |         0.0028869  |       0.58881  | 0.746526 |       0.122309 |

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