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:
|   placeID | parking_lot   |
|----------:|:--------------|
|    135111 | public        |
|    135110 | none          |
|    135109 | none          |
|    135108 | none          |
|    135107 | none          |
|    135106 | none          |
|    135105 | none          |
|    135104 | yes           |
|    135103 | valet parking |
|    135102 | valet parking |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
|   placeID | hours        | days                 |
|----------:|:-------------|:---------------------|
|    132785 | 14:00-23:30; | Sun;                 |
|    132784 | 14:00-23:30; | Mon;Tue;Wed;Thu;Fri; |
|    132784 | 14:00-23:30; | Sat;                 |
|    132784 | 14:00-23:30; | Sun;                 |
|    132783 | 11:00-23:00; | Mon;Tue;Wed;Thu;Fri; |
|    132783 | 11:00-23:30; | Sat;                 |
|    132783 | 11:00-23:30; | Sun;                 |
|    132782 | 09:00-18:00; | Mon;Tue;Wed;Thu;Fri; |
|    132782 | 10:00-18:00; | Sat;                 |
|    132782 | 10:00-18:00; | Sun;                 |


Table #3
Filename: source_2.csv
Sample Rows in Markdown:
|   placeID |   latitude |   longitude | the_geom_meter                                     | name                           | address                                | city            | state           | country   | fax   | zip   | alcohol           | smoking_area   | dress_code   | accessibility    | price   | url                   | Rambience   | franchise   | area   | other_services   |
|----------:|-----------:|------------:|:---------------------------------------------------|:-------------------------------|:---------------------------------------|:----------------|:----------------|:----------|:------|:------|:------------------|:---------------|:-------------|:-----------------|:--------|:----------------------|:------------|:------------|:-------|:-----------------|
|    134999 |    18.9154 |    -99.1849 | 0101000020957F000088568DE356715AC138C0A525FC464A41 | Kiku Cuernavaca                | Revolucion                             | Cuernavaca      | Morelos         | Mexico    | ?     | ?     | No_Alcohol_Served | none           | informal     | no_accessibility | medium  | kikucuernavaca.com.mx | familiar    | f           | closed | none             |
|    132825 |    22.1474 |   -100.983  | 0101000020957F00001AD016568C4858C1243261274BA54B41 | puesto de tacos                | esquina santos degollado y leon guzman | s.l.p.          | s.l.p.          | mexico    | ?     | 78280 | No_Alcohol_Served | none           | informal     | completely       | low     | ?                     | familiar    | f           | open   | none             |
|    135106 |    22.1497 |   -100.976  | 0101000020957F0000649D6F21634858C119AE9BF528A34B41 | El Rincón de San Francisco     | Universidad 169                        | San Luis Potosi | San Luis Potosi | Mexico    | ?     | 78000 | Wine-Beer         | only at bar    | informal     | partially        | medium  | ?                     | familiar    | f           | open   | none             |
|    132667 |    23.7527 |    -99.1634 | 0101000020957F00005D67BCDDED8157C1222A2DC8D84D4941 | little pizza Emilio Portes Gil | calle emilio portes gil                | victoria        | tamaulipas      | ?         | ?     | ?     | No_Alcohol_Served | none           | informal     | completely       | low     | ?                     | familiar    | t           | closed | none             |
|    132613 |    23.7529 |    -99.1651 | 0101000020957F00008EBA2D06DC8157C194E03B7B504E4941 | carnitas_mata                  | lic. Emilio portes gil                 | victoria        | Tamaulipas      | Mexico    | ?     | ?     | No_Alcohol_Served | permitted      | informal     | completely       | medium  | ?                     | familiar    | t           | closed | none             |
|    135040 |    22.1356 |   -100.97   | 0101000020957F00001B552189B84A58C15A2AAEFD2CA24B41 | Restaurant los Compadres       | Camino a Simon Diaz 155 Centro         | San Luis Potosi | SLP             | Mexico    | ?     | 74000 | Wine-Beer         | none           | informal     | no_accessibility | high    | ?                     | familiar    | f           | closed | none             |
|    132732 |    23.7544 |    -99.1713 | 0101000020957F00008A20E615808157C16272FECBF84F4941 | Taqueria EL amigo              | Calle Mezquite Fracc Framboyanes       | Cd Victoria     | Tamaulipas      | Mexico    | ?     | 87018 | No_Alcohol_Served | none           | casual       | completely       | low     | ?                     | familiar    | f           | open   | none             |
|    132875 |    22.1499 |   -100.994  | 0101000020957F00008A2A0747DE4758C11EB31D2A31A84B41 | shi ro ie                      | ?                                      | ?               | ?               | ?         | ?     | ?     | Wine-Beer         | section        | informal     | no_accessibility | high    | ?                     | familiar    | t           | open   | Internet         |
|    132609 |    23.7603 |    -99.1659 | 0101000020957F0000A478418BBA8057C133851EB22C4E4941 | Pollo_Frito_Buenos_Aires       | tampico                                | victoria        | Tamaulipas      | Mexico    | ?     | ?     | No_Alcohol_Served | not permitted  | informal     | completely       | low     | ?                     | quiet       | t           | closed | none             |
|    135082 |    22.1514 |   -100.915  | 0101000020957F0000A29FAF95CD4958C1FEEEBB73A9914B41 | la Estrella de Dimas           | Villa de Pozos 192 Villa de Pozos      | San Luis Potosi | SLP             | Mexico    | ?     | 78421 | No_Alcohol_Served | none           | informal     | no_accessibility | medium  | ?                     | familiar    | f           | closed | none             |


Table #4
Filename: source_3.csv
Sample Rows in Markdown:
|   placeID | Rcuisine          |
|----------:|:------------------|
|    135110 | Spanish           |
|    135109 | Italian           |
|    135107 | Latin_American    |
|    135106 | Mexican           |
|    135105 | Fast_Food         |
|    135104 | Mexican           |
|    135103 | Burgers           |
|    135103 | Dessert-Ice_Cream |
|    135103 | Fast_Food         |
|    135103 | Hot_Dogs          |


Table #5
Filename: source_4.csv
Sample Rows in Markdown:
|   placeID | Rpayment            |
|----------:|:--------------------|
|    135110 | cash                |
|    135110 | VISA                |
|    135110 | MasterCard-Eurocard |
|    135110 | American_Express    |
|    135110 | bank_debit_cards    |
|    135109 | cash                |
|    135107 | cash                |
|    135107 | VISA                |
|    135107 | MasterCard-Eurocard |
|    135107 | American_Express    |


Target Schema:
|   placeID | Rcuisine   |   latitude |   longitude | the_geom_meter                                     | name                       | address                       | city            | state           | country   | fax   | zip   | alcohol           | smoking_area   | dress_code   | accessibility    | price   | url                | Rambience   | franchise   | area   | other_services   | hours        | days                 | parking_lot   |
|----------:|:-----------|-----------:|------------:|:---------------------------------------------------|:---------------------------|:------------------------------|:----------------|:----------------|:----------|:------|:------|:------------------|:---------------|:-------------|:-----------------|:--------|:-------------------|:------------|:------------|:-------|:-----------------|:-------------|:---------------------|:--------------|
|    135109 | Italian    |    18.9218 |    -99.2353 | 0101000020957F0000A6BF695F136F5AC1DADF87B205564A41 | Paniroles                  | ?                             | ?               | ?               | ?         | ?     | ?     | Wine-Beer         | not permitted  | informal     | no_accessibility | medium  | ?                  | quiet       | f           | closed | Internet         | 08:00-21:00; | Mon;Tue;Wed;Thu;Fri; | none          |
|    135109 | Italian    |    18.9218 |    -99.2353 | 0101000020957F0000A6BF695F136F5AC1DADF87B205564A41 | Paniroles                  | ?                             | ?               | ?               | ?         | ?     | ?     | Wine-Beer         | not permitted  | informal     | no_accessibility | medium  | ?                  | quiet       | f           | closed | Internet         | 08:00-21:00; | Sat;                 | none          |
|    135109 | Italian    |    18.9218 |    -99.2353 | 0101000020957F0000A6BF695F136F5AC1DADF87B205564A41 | Paniroles                  | ?                             | ?               | ?               | ?         | ?     | ?     | Wine-Beer         | not permitted  | informal     | no_accessibility | medium  | ?                  | quiet       | f           | closed | Internet         | 08:00-21:00; | Sun;                 | none          |
|    135106 | Mexican    |    22.1497 |   -100.976  | 0101000020957F0000649D6F21634858C119AE9BF528A34B41 | El Rincón de San Francisco | Universidad 169               | San Luis Potosi | San Luis Potosi | Mexico    | ?     | 78000 | Wine-Beer         | only at bar    | informal     | partially        | medium  | ?                  | familiar    | f           | open   | none             | 18:00-23:30; | Mon;Tue;Wed;Thu;Fri; | none          |
|    135106 | Mexican    |    22.1497 |   -100.976  | 0101000020957F0000649D6F21634858C119AE9BF528A34B41 | El Rincón de San Francisco | Universidad 169               | San Luis Potosi | San Luis Potosi | Mexico    | ?     | 78000 | Wine-Beer         | only at bar    | informal     | partially        | medium  | ?                  | familiar    | f           | open   | none             | 18:00-23:30; | Sat;                 | none          |
|    135106 | Mexican    |    22.1497 |   -100.976  | 0101000020957F0000649D6F21634858C119AE9BF528A34B41 | El Rincón de San Francisco | Universidad 169               | San Luis Potosi | San Luis Potosi | Mexico    | ?     | 78000 | Wine-Beer         | only at bar    | informal     | partially        | medium  | ?                  | familiar    | f           | open   | none             | 18:00-21:00; | Sun;                 | none          |
|    135104 | Mexican    |    23.753  |    -99.1684 | 0101000020957F00007CDF5EAFC58157C1645743B23E4F4941 | vips                       | ?                             | ?               | ?               | ?         | ?     | ?     | Full_Bar          | not permitted  | informal     | completely       | medium  | ?                  | familiar    | t           | closed | variety          | 00:00-23:30; | Mon;Tue;Wed;Thu;Fri; | yes           |
|    135104 | Mexican    |    23.753  |    -99.1684 | 0101000020957F00007CDF5EAFC58157C1645743B23E4F4941 | vips                       | ?                             | ?               | ?               | ?         | ?     | ?     | Full_Bar          | not permitted  | informal     | completely       | medium  | ?                  | familiar    | t           | closed | variety          | 00:00-23:30; | Sat;                 | yes           |
|    135104 | Mexican    |    23.753  |    -99.1684 | 0101000020957F00007CDF5EAFC58157C1645743B23E4F4941 | vips                       | ?                             | ?               | ?               | ?         | ?     | ?     | Full_Bar          | not permitted  | informal     | completely       | medium  | ?                  | familiar    | t           | closed | variety          | 00:00-23:30; | Sun;                 | yes           |
|    135088 | Cafeteria  |    18.876  |    -99.2199 | 0101000020957F0000E14AD4DBC7765AC1F7B33C85B1534A41 | Cafeteria cenidet          | Interior Internado Palmira SN | Cuernavaca      | Morelos         | Mexico    | ?     | ?     | No_Alcohol_Served | not permitted  | informal     | no_accessibility | low     | www.cenidet.edu.mx | quiet       | f           | closed | none             | 09:00-16:00; | Mon;Tue;Wed;Thu;Fri; | public        |

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
source_3.csv
source_4.csv
test: test_0.csv
test_1.csv
test_2.csv
test_3.csv
test_4.csv