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:
| AccountId           | CloseDate   |   Amount | CreatedDate         | OwnerId             | Type   | Opportunity_ID__c   | Name                           | StageName                  |
|:--------------------|:------------|---------:|:--------------------|:--------------------|:-------|:--------------------|:-------------------------------|:---------------------------|
| 001E000000mRIluMUi  |             | 40071.1  | 2016-04-25 22:07:07 | 005E000000Yq3YeOfz  | NB     | 006E000000kPT0st1y8 | Tire Centers  LLC              | 5 - Business Case/Proposal |
| 001E000000rTqQZfx0b | 2016-05-04  | 21767.5  | 2016-04-25 12:13:37 | 005E000000UttrqIIQ  | NB     | 006E000000UnJ9LJ05e | Kwik Trip  Inc                 | 7 - Closed Won             |
| 001E000000MWKJ0R2Nu | 2016-05-04  | 34755.3  | 2016-04-24 02:20:16 | 005E000000OUwLH1L6  | NB     | 006E000000O61PRhrL  | Gehl Power Products  Inc       | Disqualified               |
| 001E000000zbf7twQu  | 2016-05-04  | 13831.4  | 2016-04-22 08:54:59 | 005E000000oIOzjiLn0 | NBEC   | 006E000000fiUwzcgl  | Facebook  Inc                  | Disqualified               |
| 001E000000Gsx0nz3jX | 2016-05-04  |  4036.11 | 2016-04-22 07:55:34 | 005E000000Sw83GTO6  | NB     | 006E000000m80isIqKM | Avalonbay Communities  Inc     | 7 - Closed Won             |
| 001E00000062wQ1LSR  | 2016-05-04  |  8679.15 | 2016-04-20 11:58:26 | 005E000000ZM2J0uP4f | NB     | 006E000000XqYn0Zf3Q | Coborns  Incorporated          | Disqualified               |
| 001E000000WQoaXd0zo |             |  3249.64 | 2016-04-19 21:04:20 | 005E0000008XxIwj7u  | NBEC   | 006E000000VeGmp2NW  | Continental Tire Americas  LLC | 5 - Business Case/Proposal |
| 001E0000003hcH38sp  |             |  6808.99 | 2016-04-19 06:49:31 | 005E000000QZJHnX8u  | NB     | 006E000000NoKn0fzNt | Educate  Inc                   | 5 - Business Case/Proposal |
| 001E0000002yx3maNU  | 2016-05-04  |  5256.95 | 2016-04-19 00:43:40 | 005E000000QZJHnX8u  | NBEC   | 006E000000hiMJ0dLzY | Saint Alphonsus Regional Medic | 7 - Closed Won             |
| 001E000000VyosS5fa  | 2016-05-03  |  6655.56 | 2016-04-18 22:15:58 | 005E000000UttrqIIQ  | NBEC   | 006E000000Id0m5gca8 | Shop N Save Whse Foods Inc     | 7 - Closed Won             |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
| OpportunityId       |   SplitPercentage | SplitOwnerId         | SplitAmount   | CreatedDate         |
|:--------------------|------------------:|:---------------------|:--------------|:--------------------|
| 006E000000XWo2LMQL  |               100 | 005E000000OUwLH1L6   | 123134.86     | 2015-08-25 07:19:46 |
| 006E000000K80SxYjOk |               100 | 005E000000Sw83GTO6   | 5370.05       | 2015-08-23 18:20:10 |
| 006E000000cd0c3Jqqx |               100 | 005E000000xvRXY47a   | 5793.38       | 2015-08-22 19:15:06 |
| 006E000000JXmanQPS  |               100 | 005E000000VV2QYx0tx0 | 9950.31       | 2015-08-22 06:48:32 |
| 006E0000005lnJ0XrsT |               100 | 005E000000ZM2J0uP4f  | 65505.38      | 2015-08-21 23:18:52 |
| 006E000000WehdMKLL  |                50 | 005E000000MVhzGwek   | 3137.41       | 2015-08-20 03:41:45 |
| 006E000000WehdMKLL  |                50 | 005E000000QZJHnX8u   | 3137.41       | 2015-08-20 03:41:45 |
| 006E000000WcgSZRZ2  |               100 | 005E000000VV2QYx0tx0 |               | 2015-08-19 09:24:02 |
| 006E000000gwLbdMzx0 |               100 | 005E000000nGzlGaX3   | 116972.95     | 2015-08-19 06:10:40 |
| 006E000000OTV3XH3S  |               100 | 005E000000Yq3YeOfz   | 7560.27       | 2015-08-19 05:36:50 |


Table #3
Filename: source_2.csv
Sample Rows in Markdown:
| Full_Name__c     | Sales_Team__c   | Sales_Territory__c   | Id                   |
|:-----------------|:----------------|:---------------------|:---------------------|
| Dacia Brymer     | Inside          | SMB                  | 005E0000008XxIwj7u   |
| Cindy Eck        | Field           | Enterprise           | 005E000000MVhzGwek   |
| Tiffani Moya     | Field           | Commercial           | 005E000000OUwLH1L6   |
| Thuy Mattocks    | Field           | Commercial           | 005E000000QZJHnX8u   |
| Kay Bella        | Field           | Commercial           | 005E000000Sw83GTO6   |
| Carmel Cockerham | Field           | SMB                  | 005E000000UttrqIIQ   |
| Janett Bloom     | Strategic       | Commercial           | 005E000000VV2QYx0tx0 |
| Gwyn Barner      | Field           | SMB                  | 005E000000Yq3YeOfz   |
| Rodrick Sechrest | Field           | Commercial           | 005E000000ZM2J0uP4f  |
| Dustin Batten    | Inside          | SMB                  | 005E000000a8klNwHv   |


Target Schema:
| AccountId            | CloseDate   | Amount   | CreatedDate_x       | OwnerId             | Type   | Opportunity_ID__c    | Name                           | StageName                   | OpportunityId        |   SplitPercentage | SplitOwnerId       | SplitAmount   | CreatedDate_y       | Full_Name__c   | Sales_Team__c   | Sales_Territory__c   | Id                 |
|:---------------------|:------------|:---------|:--------------------|:--------------------|:-------|:---------------------|:-------------------------------|:----------------------------|:---------------------|------------------:|:-------------------|:--------------|:--------------------|:---------------|:----------------|:---------------------|:-------------------|
| 001E000000mRIluMUi   |             | 40071.13 | 2016-04-25 22:07:07 | 005E000000Yq3YeOfz  | NB     | 006E000000kPT0st1y8  | Tire Centers  LLC              | 5 - Business Case/Proposal  | 006E000000kPT0st1y8  |               100 | 005E000000Yq3YeOfz | 40071.13      | 2016-04-25 22:07:07 | Gwyn Barner    | Field           | SMB                  | 005E000000Yq3YeOfz |
| 001E000000lhGpNI3b   | 2016-05-04  | 15463.31 | 2016-04-16 06:02:03 | 005E000000Yq3YeOfz  | NBEC   | 006E000000y80ywe9KL  | Lexmark Nordic LLC             | Disqualified                | 006E000000y80ywe9KL  |               100 | 005E000000Yq3YeOfz | 15463.31      | 2016-04-16 06:02:03 | Gwyn Barner    | Field           | SMB                  | 005E000000Yq3YeOfz |
| 001E000000YvgZ4RT3   | 2016-05-04  | 5070.2   | 2016-04-10 11:34:29 | 005E000000Yq3YeOfz  | NBEC   | 006E000000QcP6w8HO   | C & K Market  Inc              | Closed Lost                 | 006E000000QcP6w8HO   |               100 | 005E000000Yq3YeOfz | 5070.2        | 2016-04-10 11:34:29 | Gwyn Barner    | Field           | SMB                  | 005E000000Yq3YeOfz |
| 001E000000KNWs2MyK   | 2016-05-03  |          | 2016-03-13 22:56:33 | 005E000000Yq3YeOfz  | NB     | 006E000000HuZMuTx0b  | Associated Banc-Corp           | 7 - Closed Won              | 006E000000HuZMuTx0b  |                50 | 005E000000Yq3YeOfz |               | 2016-03-13 22:56:33 | Gwyn Barner    | Field           | SMB                  | 005E000000Yq3YeOfz |
| 001E000000cpd8VsRw   | 2016-05-04  | 5633.37  | 2016-02-26 05:11:55 | 005E000000Yq3YeOfz  | NB     | 006E000000sSWauXHp   | Trinity Health                 | Disqualified                | 006E000000sSWauXHp   |               100 | 005E000000Yq3YeOfz | 5633.37       | 2016-02-26 05:11:55 | Gwyn Barner    | Field           | SMB                  | 005E000000Yq3YeOfz |
| 001E000000dhs8od03K  | 2016-05-03  | 1027.93  | 2016-02-19 19:09:09 | 005E000000Yq3YeOfz  | NB     | 006E000000gRxbIHfT0  | CVS Revco DS  Inc              | Disqualified                | 006E000000gRxbIHfT0  |               100 | 005E000000Yq3YeOfz | 1027.93       | 2016-02-19 19:09:09 | Gwyn Barner    | Field           | SMB                  | 005E000000Yq3YeOfz |
| 001E000000X5Sin0d0Q4 | 2016-05-04  | 6704.94  | 2016-02-16 03:53:17 | 005E000000Sw83GTO6  | NBEC   | 006E0000003wdrQzKM   | Umb Bank  National Association | 7 - Closed Won              | 006E0000003wdrQzKM   |                50 | 005E000000Yq3YeOfz | 3352.47       | 2016-02-16 03:53:17 | Gwyn Barner    | Field           | SMB                  | 005E000000Yq3YeOfz |
| 001E0000004I7gJLJ0S  |             | 65193.21 | 2016-02-10 19:48:21 | 005E000000Yq3YeOfz  | NBEC   | 006E000000gcad0KQKW  | Flowserve Corporation          | 4 - Validate Solution/Proof | 006E000000gcad0KQKW  |               100 | 005E000000Yq3YeOfz | 65193.21      | 2016-02-10 19:48:21 | Gwyn Barner    | Field           | SMB                  | 005E000000Yq3YeOfz |
| 001E000000vfjSjQtW   | 2016-05-03  | 4001.32  | 2016-02-05 21:33:12 | 005E000000Yq3YeOfz  | NB     | 006E0000004d0x33x0bf | Piggly Wiggly Ala Distrg Inc   | Disqualified                | 006E0000004d0x33x0bf |                50 | 005E000000Yq3YeOfz | 2000.66       | 2016-02-05 21:33:12 | Gwyn Barner    | Field           | SMB                  | 005E000000Yq3YeOfz |
| 001E000000Rf3eJ01Jn0 | 2016-05-04  |          | 2016-01-31 13:31:40 | 005E000000oIOzjiLn0 | NB     | 006E000000sLd75801R  | Click Sales Inc                | Disqualified                | 006E000000sLd75801R  |                50 | 005E000000Yq3YeOfz |               | 2016-01-31 13:31:40 | Gwyn Barner    | Field           | SMB                  | 005E000000Yq3YeOfz |

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
test: test_0.csv
test_1.csv
test_2.csv