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:
|   #ID |           StatusId | Tweet                                                                                                                                       | Source             |     UserID | Latittude   | Longitude   | InReplyToScreenName   | InReplyToStatusID   | InReplyToUserID   | RetweetedStatus_StatusID   |   RetweetCount | InsertedDate        | CreatedDate         | Query   |   HourOfDay | TweetType   | Platform   | Devices   | App      |
|------:|-------------------:|:--------------------------------------------------------------------------------------------------------------------------------------------|:-------------------|-----------:|:------------|:------------|:----------------------|:--------------------|:------------------|:---------------------------|---------------:|:--------------------|:--------------------|:--------|------------:|:------------|:-----------|:----------|:---------|
| 32599 | 518425000000000000 | BIS MORGEN FREUNDE, ES WIRD NOCH MAL RICHTIG SONNIG! WIR FREUEN UNS AUF EUCH http://t.co/Mk4EuL3uV3                                         | Facebook           | 2188644997 |             |             |                       |                     |                   |                            |              0 | 2014-10-06 15:12:47 | 2014-10-04 00:00:00 | Pier1   |           8 | Original    | Facebook   | Other     | Facebook |
|  4747 | 517864000000000000 | Holla at me for ya tixxxx ???????? #thissaturday #pier1 #yehbaby http://t.co/N25buG3fhh                                                     | Instagram          |   92745146 |             |             |                       |                     |                   |                            |              0 | 2014-10-03 13:43:03 | 2014-10-02 00:00:00 | Pier1   |          19 | Original    | Other      | Other     | Other    |
| 16449 | 517838000000000000 | RT @pier1: Get stoked for fireplace weather with savings on all fireplace screens and accessories. http://t.co/UTzmFZim0z http://t.co/tZ2VJ | Twitter Web Client |   25671827 |             |             |                       |                     |                   | 5.18e+17                   |              5 | 2014-10-03 13:44:59 | 2014-10-02 00:00:00 | Pier1   |          17 | Retweet     | Web        | Web       | Twitter  |
|  9674 | 517715000000000000 | My happy place; my vanity! #love #vanity #myhappyplace #makeupaddict #pier1 #hayworthvanity http://t.co/dYP83iFSEd                          | Twitter Web Client | 2815585950 |             |             |                       |                     |                   |                            |              0 | 2014-10-03 13:43:56 | 2014-10-02 00:00:00 | Pier1   |           9 | Original    | Web        | Web       | Twitter  |
| 26555 | 518892000000000000 | RT @risnewsinsights: http://t.co/Y4DRByTBn6 @pier1 's Top 6 #Mileposts to #Omnichannel #Evolution                                           | TweetAdder v4      |  151568342 |             |             |                       |                     |                   | 5.17e+17                   |              1 | 2014-10-06 15:11:39 | 2014-10-05 00:00:00 | Pier1   |          15 | Retweet     | Other      | Other     | Other    |
| 21518 | 519218000000000000 | RT @pier1: Start a fun, new Halloween tradition by hanging some spooky ornaments from a Halloween tree. http://t.co/Jbi9iq9Riv http://t.co/ | Twitter for iPhone | 1730261094 |             |             |                       |                     |                   | 5.19e+17                   |              8 | 2014-10-06 15:10:41 | 2014-10-06 00:00:00 | Pier1   |          13 | Retweet     | Other      | Phone     | Twitter  |
| 10625 | 518076000000000000 | What does your bedroom style say about you? http://t.co/Z3I8IGXrW3                                                                          | Hootsuite          |   40949898 |             |             |                       |                     |                   |                            |              0 | 2014-10-03 13:44:07 | 2014-10-03 00:00:00 | Pier1   |           9 | Original    | Other      | Other     | Other    |
| 28100 | 518409000000000000 | RT @loodsjol: A harbourpilots job. Shifting AtlanticNavigator from pier1 to pier7. #RotterdamPilots #Nlrtm #Smittugs #Krve http://t.co/49QD | Twitter Web Client |  582040660 |             |             |                       |                     |                   | 5.18e+17                   |              4 | 2014-10-06 15:11:50 | 2014-10-04 00:00:00 | Pier1   |           7 | Retweet     | Web        | Web       | Twitter  |
|  1788 | 517676000000000000 | How to pick the perfect lamp! http://t.co/PDYsoA1wzX                                                                                        | Hootsuite          |  622993499 |             |             |                       |                     |                   |                            |              0 | 2014-10-03 13:42:32 | 2014-10-02 00:00:00 | Pier1   |           7 | Original    | Other      | Other     | Other    |
| 11948 | 517854000000000000 | RT @Princess_Jeslyn: I want and deserve Pier 1 Gift cards. Send to Princessjeslyn1@gmail.com https://t.co/4PFY26lvS9 #findom #femdom        | Twitter for iPhone | 1132036081 |             |             |                       |                     |                   | 5.18e+17                   |              1 | 2014-10-03 13:44:17 | 2014-10-02 00:00:00 | Pier1   |          18 | Retweet     | Other      | Phone     | Twitter  |


Target Schema:
| InsertedDate-date   |   #ID |   StatusId |   Tweet |   Source |   UserID |   Latittude |   Longitude |   InReplyToScreenName |   InReplyToStatusID |   InReplyToUserID |   RetweetedStatus_StatusID |   RetweetCount |   InsertedDate |   CreatedDate |   Query |   HourOfDay |   TweetType |   Platform |   Devices |   App |   InsertedDate-hour |
|:--------------------|------:|-----------:|--------:|---------:|---------:|------------:|------------:|----------------------:|--------------------:|------------------:|---------------------------:|---------------:|---------------:|--------------:|--------:|------------:|------------:|-----------:|----------:|------:|--------------------:|
| 2014-10-01          |   202 |        202 |     202 |      202 |      202 |           8 |           8 |                    34 |                  29 |                34 |                         75 |            202 |            202 |           202 |     202 |         202 |         202 |        202 |       202 |   202 |                 202 |
| 2014-10-03          |  9040 |       9040 |    9040 |     9040 |     9040 |         358 |         358 |                   962 |                 706 |               962 |                       2090 |           9040 |           9040 |          9040 |    9040 |        9040 |        9040 |       9040 |      9040 |  9040 |                9040 |
| 2014-10-06          |  8942 |       8942 |    8942 |     8942 |     8942 |         628 |         628 |                  1324 |                1047 |              1324 |                       2420 |           8942 |           8942 |          8942 |    8942 |        8942 |        8942 |       8942 |      8942 |  8942 |                8942 |

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