Task: Transform-by-output-target-schema (source dataset: commercial-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:
|        a | b   | c              |        d |
|---------:|:----|:---------------|---------:|
| 0.645536 | AUD | 7/1/2005 0:00  | 0.645161 |
| 0.642715 | AUD | 7/2/2005 0:00  | 0.642756 |
| 0.641355 | AUD | 7/3/2005 0:00  | 0.641149 |
| 0.639182 | AUD | 7/4/2005 0:00  | 0.639632 |
| 0.638284 | AUD | 7/5/2005 0:00  | 0.638162 |
| 0.639304 | AUD | 7/6/2005 0:00  | 0.63955  |
| 0.639182 | AUD | 7/7/2005 0:00  | 0.638896 |
| 0.637796 | AUD | 7/8/2005 0:00  | 0.637836 |
| 0.63589  | AUD | 7/9/2005 0:00  | 0.635566 |
| 0.632511 | AUD | 7/10/2005 0:00 | 0.632511 |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
|   a | b   | c              |   d |
|----:|:----|:---------------|----:|
|   1 | USD | 7/1/2005 0:00  |   1 |
|   1 | USD | 7/2/2005 0:00  |   1 |
|   1 | USD | 7/3/2005 0:00  |   1 |
|   1 | USD | 7/4/2005 0:00  |   1 |
|   1 | USD | 7/5/2005 0:00  |   1 |
|   1 | USD | 7/6/2005 0:00  |   1 |
|   1 | USD | 7/7/2005 0:00  |   1 |
|   1 | USD | 7/8/2005 0:00  |   1 |
|   1 | USD | 7/9/2005 0:00  |   1 |
|   1 | USD | 7/10/2005 0:00 |   1 |


Table #3
Filename: source_10.csv
Sample Rows in Markdown:
|       a | b   | c              |       d |
|--------:|:----|:---------------|--------:|
| 1.61734 | GBP | 7/1/2005 0:00  | 1.61734 |
| 1.6218  | GBP | 7/2/2005 0:00  | 1.62285 |
| 1.62443 | GBP | 7/3/2005 0:00  | 1.62259 |
| 1.62259 | GBP | 7/4/2005 0:00  | 1.62364 |
| 1.61681 | GBP | 7/5/2005 0:00  | 1.61655 |
| 1.61838 | GBP | 7/6/2005 0:00  | 1.61996 |
| 1.61891 | GBP | 7/7/2005 0:00  | 1.61838 |
| 1.62048 | GBP | 7/8/2005 0:00  | 1.62259 |
| 1.62364 | GBP | 7/9/2005 0:00  | 1.62259 |
| 1.61525 | GBP | 7/10/2005 0:00 | 1.61577 |


Table #4
Filename: source_11.csv
Sample Rows in Markdown:
|        a | b   | c              |        d |
|---------:|:----|:---------------|---------:|
| 0.106678 | MXN | 7/1/2005 0:00  | 0.106564 |
| 0.106441 | MXN | 7/2/2005 0:00  | 0.106475 |
| 0.106895 | MXN | 7/3/2005 0:00  | 0.106895 |
| 0.106998 | MXN | 7/4/2005 0:00  | 0.107102 |
| 0.107124 | MXN | 7/5/2005 0:00  | 0.107102 |
| 0.107124 | MXN | 7/6/2005 0:00  | 0.107216 |
| 0.107124 | MXN | 7/7/2005 0:00  | 0.107022 |
| 0.107239 | MXN | 7/8/2005 0:00  | 0.107262 |
| 0.107068 | MXN | 7/9/2005 0:00  | 0.107068 |
| 0.107446 | MXN | 7/10/2005 0:00 | 0.10754  |


Table #5
Filename: source_12.csv
Sample Rows in Markdown:
|       a | b   | c              |       d |
|--------:|:----|:---------------|--------:|
| 0.00158 | VEB | 7/1/2005 0:00  | 0.00158 |
| 0.00158 | VEB | 7/2/2005 0:00  | 0.00158 |
| 0.00158 | VEB | 7/3/2005 0:00  | 0.00158 |
| 0.00157 | VEB | 7/4/2005 0:00  | 0.00157 |
| 0.00157 | VEB | 7/5/2005 0:00  | 0.00157 |
| 0.00157 | VEB | 7/6/2005 0:00  | 0.00157 |
| 0.00157 | VEB | 7/7/2005 0:00  | 0.00157 |
| 0.00157 | VEB | 7/8/2005 0:00  | 0.00157 |
| 0.00157 | VEB | 7/9/2005 0:00  | 0.00157 |
| 0.00157 | VEB | 7/10/2005 0:00 | 0.00157 |


Table #6
Filename: source_13.csv
Sample Rows in Markdown:
|   a | b   | c              |        d |
|----:|:----|:---------------|---------:|
|   1 | ARS | 7/1/2005 0:00  | 0.9998   |
|   1 | ARS | 7/2/2005 0:00  | 1.0009   |
|   1 | ARS | 7/3/2005 0:00  | 0.9996   |
|   1 | ARS | 7/4/2005 0:00  | 1        |
|   1 | ARS | 7/5/2005 0:00  | 0.9996   |
|   1 | ARS | 7/6/2005 0:00  | 1.0005   |
|   1 | ARS | 7/7/2005 0:00  | 0.9995   |
|   1 | ARS | 7/8/2005 0:00  | 1.0002   |
|   1 | ARS | 7/9/2005 0:00  | 0.999201 |
|   1 | ARS | 7/10/2005 0:00 | 1.0002   |


Table #7
Filename: source_2.csv
Sample Rows in Markdown:
|        a | b   | c              |        d |
|---------:|:----|:---------------|---------:|
| 0.157206 | FRF | 7/1/2005 0:00  | 0.157201 |
| 0.15756  | FRF | 7/2/2005 0:00  | 0.157567 |
| 0.158627 | FRF | 7/3/2005 0:00  | 0.158627 |
| 0.158504 | FRF | 7/4/2005 0:00  | 0.158529 |
| 0.157099 | FRF | 7/5/2005 0:00  | 0.157089 |
| 0.156873 | FRF | 7/6/2005 0:00  | 0.156882 |
| 0.15704  | FRF | 7/7/2005 0:00  | 0.157033 |
| 0.15722  | FRF | 7/8/2005 0:00  | 0.15722  |
| 0.157206 | FRF | 7/9/2005 0:00  | 0.157201 |
| 0.15597  | FRF | 7/10/2005 0:00 | 0.155984 |


Table #8
Filename: source_3.csv
Sample Rows in Markdown:
|        a | b   | c              |        d |
|---------:|:----|:---------------|---------:|
| 0.516022 | BRL | 7/1/2005 0:00  | 0.51496  |
| 0.51709  | BRL | 7/2/2005 0:00  | 0.517331 |
| 0.516556 | BRL | 7/3/2005 0:00  | 0.514403 |
| 0.518269 | BRL | 7/4/2005 0:00  | 0.519481 |
| 0.517625 | BRL | 7/5/2005 0:00  | 0.516262 |
| 0.517331 | BRL | 7/6/2005 0:00  | 0.519481 |
| 0.517331 | BRL | 7/7/2005 0:00  | 0.516022 |
| 0.517331 | BRL | 7/8/2005 0:00  | 0.520061 |
| 0.517331 | BRL | 7/9/2005 0:00  | 0.51709  |
| 0.518403 | BRL | 7/10/2005 0:00 | 0.52086  |


Table #9
Filename: source_4.csv
Sample Rows in Markdown:
|        a | b   | c              |        d |
|---------:|:----|:---------------|---------:|
| 0.266617 | SAR | 7/1/2005 0:00  | 0.266071 |
| 0.266617 | SAR | 7/2/2005 0:00  | 0.266617 |
| 0.266631 | SAR | 7/3/2005 0:00  | 0.26617  |
| 0.266724 | SAR | 7/4/2005 0:00  | 0.267265 |
| 0.266617 | SAR | 7/5/2005 0:00  | 0.265915 |
| 0.266617 | SAR | 7/6/2005 0:00  | 0.266667 |
| 0.266603 | SAR | 7/7/2005 0:00  | 0.266198 |
| 0.266617 | SAR | 7/8/2005 0:00  | 0.267308 |
| 0.266617 | SAR | 7/9/2005 0:00  | 0.266276 |
| 0.266617 | SAR | 7/10/2005 0:00 | 0.266652 |


Table #10
Filename: source_5.csv
Sample Rows in Markdown:
|       a | b   | c              |       d |
|--------:|:----|:---------------|--------:|
| 1.03125 | EUR | 7/1/2005 0:00  | 1.03061 |
| 1.03348 | EUR | 7/2/2005 0:00  | 1.03413 |
| 1.04058 | EUR | 7/3/2005 0:00  | 1.04004 |
| 1.03983 | EUR | 7/4/2005 0:00  | 1.03983 |
| 1.0305  | EUR | 7/5/2005 0:00  | 1.02976 |
| 1.02902 | EUR | 7/6/2005 0:00  | 1.02934 |
| 1.03008 | EUR | 7/7/2005 0:00  | 1.02923 |
| 1.03125 | EUR | 7/8/2005 0:00  | 1.03199 |
| 1.03125 | EUR | 7/9/2005 0:00  | 1.03029 |
| 1.02312 | EUR | 7/10/2005 0:00 | 1.02354 |


Table #11
Filename: source_6.csv
Sample Rows in Markdown:
|        a | b   | c              |        d |
|---------:|:----|:---------------|---------:|
| 0.683013 | CAD | 7/1/2005 0:00  | 0.68106  |
| 0.682082 | CAD | 7/2/2005 0:00  | 0.683201 |
| 0.68157  | CAD | 7/3/2005 0:00  | 0.678702 |
| 0.68157  | CAD | 7/4/2005 0:00  | 0.68451  |
| 0.68306  | CAD | 7/5/2005 0:00  | 0.681524 |
| 0.683013 | CAD | 7/6/2005 0:00  | 0.686672 |
| 0.683948 | CAD | 7/7/2005 0:00  | 0.682082 |
| 0.683854 | CAD | 7/8/2005 0:00  | 0.684744 |
| 0.682221 | CAD | 7/9/2005 0:00  | 0.677874 |
| 0.681292 | CAD | 7/10/2005 0:00 | 0.685495 |


Table #12
Filename: source_7.csv
Sample Rows in Markdown:
|        a | b   | c              |        d |
|---------:|:----|:---------------|---------:|
| 0.527232 | DEM | 7/1/2005 0:00  | 0.526981 |
| 0.52843  | DEM | 7/2/2005 0:00  | 0.528485 |
| 0.532028 | DEM | 7/3/2005 0:00  | 0.531858 |
| 0.531604 | DEM | 7/4/2005 0:00  | 0.531887 |
| 0.526926 | DEM | 7/5/2005 0:00  | 0.526759 |
| 0.526122 | DEM | 7/6/2005 0:00  | 0.526399 |
| 0.526676 | DEM | 7/7/2005 0:00  | 0.526593 |
| 0.527287 | DEM | 7/8/2005 0:00  | 0.52751  |
| 0.527232 | DEM | 7/9/2005 0:00  | 0.52712  |
| 0.523095 | DEM | 7/10/2005 0:00 | 0.523314 |


Table #13
Filename: source_8.csv
Sample Rows in Markdown:
|        a | b   | c              |        d |
|---------:|:----|:---------------|---------:|
| 0.120801 | CNY | 7/1/2005 0:00  | 0.120796 |
| 0.120801 | CNY | 7/2/2005 0:00  | 0.120811 |
| 0.120801 | CNY | 7/3/2005 0:00  | 0.120789 |
| 0.120798 | CNY | 7/4/2005 0:00  | 0.120799 |
| 0.120796 | CNY | 7/5/2005 0:00  | 0.12079  |
| 0.120796 | CNY | 7/6/2005 0:00  | 0.120802 |
| 0.120796 | CNY | 7/7/2005 0:00  | 0.120796 |
| 0.120796 | CNY | 7/8/2005 0:00  | 0.120804 |
| 0.120798 | CNY | 7/9/2005 0:00  | 0.120793 |
| 0.120798 | CNY | 7/10/2005 0:00 | 0.120804 |


Table #14
Filename: source_9.csv
Sample Rows in Markdown:
|       a | b   | c               |       d |
|--------:|:----|:----------------|--------:|
| 0.0081  | JPY | 12/31/2006 0:00 | 0.00809 |
| 0.00809 | JPY | 1/1/2007 0:00   | 0.00809 |
| 0.00816 | JPY | 1/2/2007 0:00   | 0.00816 |
| 0.00809 | JPY | 1/3/2007 0:00   | 0.00809 |
| 0.00809 | JPY | 1/4/2007 0:00   | 0.00809 |
| 0.00809 | JPY | 1/5/2007 0:00   | 0.0081  |
| 0.00815 | JPY | 1/6/2007 0:00   | 0.00814 |
| 0.00814 | JPY | 1/7/2007 0:00   | 0.00815 |
| 0.00834 | JPY | 1/8/2007 0:00   | 0.00834 |
| 0.00834 | JPY | 1/9/2007 0:00   | 0.00834 |


Target Schema:
|       a | b   | c              |       d |
|--------:|:----|:---------------|--------:|
| 0.00953 | JPY | 7/1/2005 0:00  | 0.00953 |
| 0.00946 | JPY | 7/2/2005 0:00  | 0.00946 |
| 0.00948 | JPY | 7/3/2005 0:00  | 0.00947 |
| 0.00945 | JPY | 7/4/2005 0:00  | 0.00946 |
| 0.00942 | JPY | 7/5/2005 0:00  | 0.00942 |
| 0.0094  | JPY | 7/6/2005 0:00  | 0.0094  |
| 0.0094  | JPY | 7/7/2005 0:00  | 0.00939 |
| 0.00946 | JPY | 7/8/2005 0:00  | 0.00946 |
| 0.00957 | JPY | 7/9/2005 0:00  | 0.00957 |
| 0.00956 | JPY | 7/10/2005 0:00 | 0.00956 |

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_10.csv
source_11.csv
source_12.csv
source_13.csv
source_2.csv
source_3.csv
source_4.csv
source_5.csv
source_6.csv
source_7.csv
source_8.csv
source_9.csv
test: test_0.csv
test_1.csv
test_10.csv
test_11.csv
test_12.csv
test_13.csv
test_2.csv
test_3.csv
test_4.csv
test_5.csv
test_6.csv
test_7.csv
test_8.csv
test_9.csv