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:
| Date       |   CFALTERYX.FB - Open |   CFALTERYX.FB - High |   CFALTERYX.FB - Low |   CFALTERYX.FB - Close |   CFALTERYX.FB - Volume |   CFALTERYX.TWTR - Open |   CFALTERYX.TWTR - High |   CFALTERYX.TWTR - Low |   CFALTERYX.TWTR - Close |   CFALTERYX.TWTR - Volume |   CFALTERYX.AAPL - Open |   CFALTERYX.AAPL - High |   CFALTERYX.AAPL - Low |   CFALTERYX.AAPL - Close |   CFALTERYX.AAPL - Volume |   CFALTERYX.SBUX - Open |   CFALTERYX.SBUX - High |   CFALTERYX.SBUX - Low |   CFALTERYX.SBUX - Close |   CFALTERYX.SBUX - Volume |   CFALTERYX.MSFT - Open |   CFALTERYX.MSFT - High |   CFALTERYX.MSFT - Low |   CFALTERYX.MSFT - Close |   CFALTERYX.MSFT - Volume |
|:-----------|----------------------:|----------------------:|---------------------:|-----------------------:|------------------------:|------------------------:|------------------------:|-----------------------:|-------------------------:|--------------------------:|------------------------:|------------------------:|-----------------------:|-------------------------:|--------------------------:|------------------------:|------------------------:|-----------------------:|-------------------------:|--------------------------:|------------------------:|------------------------:|-----------------------:|-------------------------:|--------------------------:|
| 2014-03-18 |                 68.76 |                 69.6  |                68.3  |                  69.19 |                40827226 |                   52.03 |                   52.21 |                  50.29 |                    51.13 |                  12228931 |                  525.9  |                  531.97 |                 525.2  |                   531.4  |                   7487409 |                   74.35 |                   74.84 |                  74.05 |                    74.6  |                   2998760 |                   38.26 |                   39.9  |                  38.22 |                    39.55 |                  64063866 |
| 2014-03-17 |                 68.18 |                 68.95 |                66.62 |                  68.74 |                52196699 |                   52.08 |                   52.49 |                  51.35 |                    52.05 |                   6600907 |                  527.7  |                  529.97 |                 525.85 |                   526.74 |                   7126582 |                   74.81 |                   74.99 |                  73.82 |                    74.18 |                   5509947 |                   37.9  |                   38.41 |                  37.79 |                    38.05 |                  20479610 |
| 2014-03-14 |                 68.49 |                 69.43 |                67.46 |                  67.72 |                48226824 |                   53.4  |                   53.91 |                  51.8  |                    51.92 |                   9570412 |                  528.79 |                  530.89 |                 523    |                   524.69 |                   8471356 |                   74.09 |                   74.89 |                  74.02 |                    74.27 |                   4481301 |                   37.65 |                   38.14 |                  37.51 |                    37.7  |                  27195638 |
| 2014-03-13 |                 71.29 |                 71.35 |                68.15 |                  68.83 |                57091157 |                   54.9  |                   55.45 |                  53.2  |                    53.57 |                   7671506 |                  537.44 |                  539.66 |                 529.16 |                   530.65 |                   9205087 |                   75.84 |                   76.42 |                  74.03 |                    74.43 |                   5690391 |                   38.42 |                   38.45 |                  37.64 |                    37.89 |                  32169650 |
| 2014-03-12 |                 69.86 |                 71.35 |                69    |                  70.88 |                46400431 |                   54.25 |                   55.3  |                  53.88 |                    54.5  |                   5839493 |                  534.51 |                  537.35 |                 532    |                   536.61 |                   7170780 |                   74.55 |                   75.66 |                  74.5  |                    75.63 |                   5225431 |                   37.8  |                   38.43 |                  37.79 |                    38.27 |                  30496295 |
| 2014-03-11 |                 72.5  |                 72.59 |                69.96 |                  70.1  |                59615238 |                   54.16 |                   55.84 |                  53.8  |                    54.02 |                  11777991 |                  535.45 |                  538.74 |                 532.59 |                   536.09 |                  10028407 |                   73.99 |                   75.41 |                  73.85 |                    75.03 |                   9184375 |                   37.87 |                   38.23 |                  37.72 |                    38.02 |                  25218133 |
| 2014-03-10 |                 70.77 |                 72.15 |                70.51 |                  72.03 |                59949746 |                   54.09 |                   54.59 |                  53.38 |                    53.88 |                   5789363 |                  528.36 |                  533.33 |                 528.34 |                   530.92 |                   6384490 |                   73.25 |                   73.64 |                  72.79 |                    73.56 |                   4324388 |                   37.99 |                   38.01 |                  37.72 |                    37.82 |                  19007850 |
| 2014-03-07 |                 71.08 |                 71.18 |                69.47 |                  69.8  |                38985763 |                   55.18 |                   55.2  |                  53.31 |                    53.53 |                   7325092 |                  531.09 |                  531.98 |                 526.05 |                   530.44 |                   7916463 |                   72.99 |                   73.1  |                  72.21 |                    73.07 |                   4204686 |                   38.28 |                   38.36 |                  37.69 |                    37.9  |                  26596635 |
| 2014-03-06 |                 71.88 |                 71.89 |                70.25 |                  70.84 |                46126260 |                   54.91 |                   56.09 |                  54.7  |                    54.83 |                   9034361 |                  532.79 |                  534.44 |                 528.1  |                   530.75 |                   6631873 |                   71.83 |                   73.34 |                  71.77 |                    72.69 |                   6890524 |                   38.14 |                   38.24 |                  37.89 |                    38.15 |                  23605310 |
| 2014-03-05 |                 69.69 |                 71.97 |                69.62 |                  71.57 |                74649486 |                   54.53 |                   55.03 |                  53.75 |                    54.38 |                   5681226 |                  530.92 |                  534.75 |                 529.13 |                   532.36 |                   7152217 |                   71.99 |                   72.09 |                  70.88 |                    71.3  |                   4891705 |                   38.25 |                   38.27 |                  37.93 |                    38.11 |                  20520432 |


Target Schema:
| Date       | Stock   |   Close |   High |    Low |   Open |   Volume |
|:-----------|:--------|--------:|-------:|-------:|-------:|---------:|
| 2014-03-19 | AAPL    |  531.26 | 536.24 | 529    | 532.26 |  8026994 |
| 2014-03-19 | FB      |   68.24 |  69.29 |  67.46 |  69.17 | 43980558 |
| 2014-03-19 | MSFT    |   39.27 |  39.55 |  38.91 |  39.47 | 35597241 |
| 2014-03-19 | SBUX    |   75.91 |  77.33 |  74.82 |  75    | 12491570 |
| 2014-03-19 | TWTR    |   51.24 |  51.98 |  50.71 |  50.8  |  7624177 |
| 2014-03-20 | AAPL    |  528.7  | 532.67 | 527.35 | 529.89 |  7442791 |
| 2014-03-20 | FB      |   66.97 |  68.23 |  66.82 |  68.01 | 44438500 |
| 2014-03-20 | MSFT    |   40.33 |  40.65 |  39.24 |  39.25 | 59269801 |
| 2014-03-20 | SBUX    |   76.96 |  77.13 |  75.6  |  76.29 |  6925738 |
| 2014-03-20 | TWTR    |   50.12 |  51.66 |  49.64 |  51    | 10086189 |

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