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:
|   bid_id | bidder_id                             | auction   | merchandise    | device   |             time | country   | ip              | url             |
|---------:|:--------------------------------------|:----------|:---------------|:---------|-----------------:|:----------|:----------------|:----------------|
|  1414604 | 45bd56666e7f3693a319ac24d7dd4046m5ime | jefix     | home goods     | phone3   | 9767600526315789 | in        | 28.165.204.53   | 4xqm4n9uqraru4q |
|  1417398 | 8393c48eaf4b8fa96886edc7cf27b372dsibi | jefix     | jewelry        | phone61  | 9767617526315789 | in        | 201.107.22.155  | 1je0ieuub9ci1ke |
|  1417918 | 3939ac3ef7d472a59a9c5f893dd3e39fh9ofi | jefix     | jewelry        | phone35  | 9767620736842105 | in        | 3.137.205.229   | fz8ic5o04mwj7un |
|  1419910 | 50a4bfbac8a9653af4099ec1169f684c2nsgu | jefix     | jewelry        | phone65  | 9767632789473684 | in        | 159.154.50.216  | vasstdc27m7nks3 |
|  1425315 | e7bd8c579adda24d5cbab02d84999f3btlvm6 | jefix     | clothing       | phone11  | 9767666894736842 |           | 30.207.149.93   | puexjzf1cw3yf7z |
|  1425592 | 990db0dcdb665fb8fda5845b3e5d63082mbqq | jefix     | home goods     | phone4   | 9767668526315789 | uk        | 217.91.1.214    | vasstdc27m7nks3 |
|  1428108 | a50f58ceb34c347c33e8b22f4470d928mwjew | jefix     | sporting goods | phone28  | 9767684263157894 | sa        | 188.215.157.184 | xrz5k3cq8whl3qp |
|  1430750 | 2419ed502cf6b4cc6feb0a47697a045b4gqiq | jefix     | mobile         | phone65  | 9767700000000000 | in        | 11.94.28.51     | vasstdc27m7nks3 |
|  1437090 | 50a4bfbac8a9653af4099ec1169f684c2nsgu | jefix     | jewelry        | phone543 | 9767736368421052 | in        | 50.201.125.84   | arjfy9ijgnausvu |
|  1442991 | ae6758a627a111f6d6b530b0154c429566o4k | jefix     | mobile         | phone61  | 9767772157894736 | in        | 207.211.191.163 | mnajv6tk4g33oil |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
| bidder_id                             | payment_account                       | address                               |
|:--------------------------------------|:--------------------------------------|:--------------------------------------|
| 49bb5a3c944b8fc337981cc7a9ccae41u31d7 | a3d2de7675556553a5f08e4c88d2c228htx90 | 5d9fa1b71f992e7c7a106ce4b07a0a754le7c |
| a921612b85a1494456e74c09393ccb65ylp4y | a3d2de7675556553a5f08e4c88d2c228rs17i | a3d2de7675556553a5f08e4c88d2c228klidn |
| 6b601e72a4d264dab9ace9d7b229b47479v6i | 925381cce086b8cc9594eee1c77edf665zjpl | a3d2de7675556553a5f08e4c88d2c228aght0 |
| eaf0ed0afc9689779417274b4791726cn5udi | a3d2de7675556553a5f08e4c88d2c228nclv5 | b5714de1fd69d4a0d2e39d59e53fe9e15vwat |
| cdecd8d02ed8c6037e38042c7745f688mx5sf | a3d2de7675556553a5f08e4c88d2c228dtdkd | c3b363a3c3b838d58c85acf0fc9964cb4pnfa |
| d4aed439bdc854a56fc6cc3bdb986775w7hxw | a3d2de7675556553a5f08e4c88d2c228v4x1f | 913a23ad701018bedd9d558f236f878267nrk |
| ed591299b162a19ff77f0479495831b31hl1q | a3d2de7675556553a5f08e4c88d2c228dpzl7 | a3d2de7675556553a5f08e4c88d2c228i8yzg |
| eebdee08b0f67283126ef60307f49680sb9va | 4eb7c53cbfbd4befdedb5854526d1907ct8xt | 7161605c31a8bbf7fc3fb0d77a26c163vdgvg |
| 6887f0abc4eb4c79eb0e23c48ceea186vjfih | a3d2de7675556553a5f08e4c88d2c228vufvy | 1a2569f191c87f8bdae1bd23506f0ff5tnfvs |
| 37eb6e2979e66d4ce29a74ac1c8bc6a5lqs6t | a3d2de7675556553a5f08e4c88d2c22838x5m | 29ba44254742e88a665e8fced9fc82b7947da |


Table #3
Filename: source_2.csv
Sample Rows in Markdown:
| bidder_id                             | payment_account                       | address                               |   outcome |
|:--------------------------------------|:--------------------------------------|:--------------------------------------|----------:|
| 91a3c57b13234af24875c56fb7e2b2f4rb56a | a3d2de7675556553a5f08e4c88d2c228754av | a3d2de7675556553a5f08e4c88d2c228vt0u4 |         0 |
| 624f258b49e77713fc34034560f93fb3hu3jo | a3d2de7675556553a5f08e4c88d2c228v1sga | ae87054e5a97a8f840a3991d12611fdcrfbq3 |         0 |
| 1c5f4fc669099bfbfac515cd26997bd12ruaj | a3d2de7675556553a5f08e4c88d2c2280cybl | 92520288b50f03907041887884ba49c0cl0pd |         0 |
| 4bee9aba2abda51bf43d639013d6efe12iycd | 51d80e233f7b6a7dfdee484a3c120f3b2ita8 | 4cb9717c8ad7e88a9a284989dd79b98dbevyi |         0 |
| 4ab12bc61c82ddd9c2d65e60555808acqgos1 | a3d2de7675556553a5f08e4c88d2c22857ddh | 2a96c3ce94b3be921e0296097b88b56a7x1ji |         0 |
| 7eaefc97fbf6af12e930528151f86eb91bafh | a3d2de7675556553a5f08e4c88d2c228yory1 | 5a1d8f28bc31aa6d72bef2d8fbf48b967hra3 |         0 |
| 25558d24bca82beef0f9db4ba1fe2045ynnvq | 81580585d4dedd473da11aabf37fe9d4e2s2n | 9a6d81115b9b653ba326eb510e9163b47drqj |         0 |
| 88ae7a35e374a6fddd079ebb28c822eeohwse | a3d2de7675556553a5f08e4c88d2c2289zref | 3a7e6a32b24aeab0688e91a41f3188e22iuec |         0 |
| 57db69e32163f3e486dc6ef7d615aa12usje6 | bf1c3151cc309308077ad0ccb99779ad12apw | 31b95425d178b89fd7306762bb48bfb5n04sj |         0 |
| d1be739798ba0745a1fd72ac918a9f1929hei | f49162ea9903fc00e4721d2f7972df9d6az4s | 5b1f6e97a1cc27cd7fa9a3fe17eccd2a6mpdv |         0 |


Target Schema:
| bidder_id                             | payment_account                       | address                               |   outcome | country   |   bids_count |
|:--------------------------------------|:--------------------------------------|:--------------------------------------|----------:|:----------|-------------:|
| 585e7c21b80baf2225224fe140cdb1a73ddrf | a3d2de7675556553a5f08e4c88d2c228bvufu | a3d2de7675556553a5f08e4c88d2c22881vc1 |         0 | id        |            1 |
| d91a4421996dcf429f575e372915cdcedae6g | a3d2de7675556553a5f08e4c88d2c2286gew9 | e350bda3ceb6067cad400ae931c3527aetdd8 |         0 | in        |            2 |
| d91a4421996dcf429f575e372915cdcedae6g | a3d2de7675556553a5f08e4c88d2c2286gew9 | e350bda3ceb6067cad400ae931c3527aetdd8 |         0 | ru        |            1 |
| 067ff22ebf0d33fe0deedc816d75973865jo7 | a3d2de7675556553a5f08e4c88d2c22848lqa | 022b06519985716abd9fc8ce83540d58wsgo1 |         0 | id        |            1 |
| eaaae0fb54c7d36724a9679c3128d5a7gn4k5 | a3d2de7675556553a5f08e4c88d2c2282n8m4 | a3d2de7675556553a5f08e4c88d2c22856io3 |         0 | eu        |            1 |
| eaaae0fb54c7d36724a9679c3128d5a7gn4k5 | a3d2de7675556553a5f08e4c88d2c2282n8m4 | a3d2de7675556553a5f08e4c88d2c22856io3 |         0 | gr        |            1 |
| eaaae0fb54c7d36724a9679c3128d5a7gn4k5 | a3d2de7675556553a5f08e4c88d2c2282n8m4 | a3d2de7675556553a5f08e4c88d2c22856io3 |         0 | ro        |            1 |
| eaaae0fb54c7d36724a9679c3128d5a7gn4k5 | a3d2de7675556553a5f08e4c88d2c2282n8m4 | a3d2de7675556553a5f08e4c88d2c22856io3 |         0 | ru        |            1 |
| a22fdc066a738070c6e4860924d06657hengu | 82eb4cc834e4a54966cface1db3743e3e6n3r | a4b537419b53270759680e72232caeb9jnqc1 |         0 | id        |            5 |
| 1476226300a93d22b15253ed7339429a7ijk0 | a3d2de7675556553a5f08e4c88d2c228yd4f4 | a3d2de7675556553a5f08e4c88d2c228z6lmo |         0 | id        |            1 |

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