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:
|   MaritalStatus_Divorced |   MaritalStatus_Married |   MaritalStatus_Single |
|-------------------------:|------------------------:|-----------------------:|
|                        0 |                       0 |                      1 |
|                        0 |                       1 |                      0 |
|                        0 |                       0 |                      1 |
|                        0 |                       1 |                      0 |
|                        0 |                       1 |                      0 |
|                        0 |                       0 |                      1 |
|                        0 |                       1 |                      0 |
|                        1 |                       0 |                      0 |
|                        0 |                       0 |                      1 |
|                        0 |                       1 |                      0 |


Table #2
Filename: source_1.csv
Sample Rows in Markdown:
|   OverTime_No |   OverTime_Yes |
|--------------:|---------------:|
|             0 |              1 |
|             1 |              0 |
|             0 |              1 |
|             0 |              1 |
|             1 |              0 |
|             1 |              0 |
|             0 |              1 |
|             1 |              0 |
|             1 |              0 |
|             1 |              0 |


Table #3
Filename: source_2.csv
Sample Rows in Markdown:
|   JobRole_Healthcare Representative |   JobRole_Human Resources |   JobRole_Laboratory Technician |   JobRole_Manager |   JobRole_Manufacturing Director |   JobRole_Research Director |   JobRole_Research Scientist |   JobRole_Sales Executive |   JobRole_Sales Representative |
|------------------------------------:|--------------------------:|--------------------------------:|------------------:|---------------------------------:|----------------------------:|-----------------------------:|--------------------------:|-------------------------------:|
|                                   0 |                         0 |                               0 |                 0 |                                0 |                           0 |                            0 |                         1 |                              0 |
|                                   0 |                         0 |                               0 |                 0 |                                0 |                           0 |                            1 |                         0 |                              0 |
|                                   0 |                         0 |                               1 |                 0 |                                0 |                           0 |                            0 |                         0 |                              0 |
|                                   0 |                         0 |                               0 |                 0 |                                0 |                           0 |                            1 |                         0 |                              0 |
|                                   0 |                         0 |                               1 |                 0 |                                0 |                           0 |                            0 |                         0 |                              0 |
|                                   0 |                         0 |                               1 |                 0 |                                0 |                           0 |                            0 |                         0 |                              0 |
|                                   0 |                         0 |                               1 |                 0 |                                0 |                           0 |                            0 |                         0 |                              0 |
|                                   0 |                         0 |                               1 |                 0 |                                0 |                           0 |                            0 |                         0 |                              0 |
|                                   0 |                         0 |                               0 |                 0 |                                1 |                           0 |                            0 |                         0 |                              0 |
|                                   1 |                         0 |                               0 |                 0 |                                0 |                           0 |                            0 |                         0 |                              0 |


Table #4
Filename: source_3.csv
Sample Rows in Markdown:
|   EducationField_Human Resources |   EducationField_Life Sciences |   EducationField_Marketing |   EducationField_Medical |   EducationField_Other |   EducationField_Technical Degree |
|---------------------------------:|-------------------------------:|---------------------------:|-------------------------:|-----------------------:|----------------------------------:|
|                                0 |                              1 |                          0 |                        0 |                      0 |                                 0 |
|                                0 |                              1 |                          0 |                        0 |                      0 |                                 0 |
|                                0 |                              0 |                          0 |                        0 |                      1 |                                 0 |
|                                0 |                              1 |                          0 |                        0 |                      0 |                                 0 |
|                                0 |                              0 |                          0 |                        1 |                      0 |                                 0 |
|                                0 |                              1 |                          0 |                        0 |                      0 |                                 0 |
|                                0 |                              0 |                          0 |                        1 |                      0 |                                 0 |
|                                0 |                              1 |                          0 |                        0 |                      0 |                                 0 |
|                                0 |                              1 |                          0 |                        0 |                      0 |                                 0 |
|                                0 |                              0 |                          0 |                        1 |                      0 |                                 0 |


Table #5
Filename: source_4.csv
Sample Rows in Markdown:
|   Department_Human Resources |   Department_Research & Development |   Department_Sales |
|-----------------------------:|------------------------------------:|-------------------:|
|                            0 |                                   0 |                  1 |
|                            0 |                                   1 |                  0 |
|                            0 |                                   1 |                  0 |
|                            0 |                                   1 |                  0 |
|                            0 |                                   1 |                  0 |
|                            0 |                                   1 |                  0 |
|                            0 |                                   1 |                  0 |
|                            0 |                                   1 |                  0 |
|                            0 |                                   1 |                  0 |
|                            0 |                                   1 |                  0 |


Table #6
Filename: source_5.csv
Sample Rows in Markdown:
|   BusinessTravel_Non-Travel |   BusinessTravel_Travel_Frequently |   BusinessTravel_Travel_Rarely |
|----------------------------:|-----------------------------------:|-------------------------------:|
|                           0 |                                  0 |                              1 |
|                           0 |                                  0 |                              1 |
|                           0 |                                  0 |                              1 |
|                           0 |                                  0 |                              1 |
|                           0 |                                  0 |                              1 |
|                           0 |                                  0 |                              1 |
|                           0 |                                  0 |                              1 |
|                           0 |                                  0 |                              1 |
|                           0 |                                  0 |                              1 |
|                           0 |                                  0 |                              1 |


Table #7
Filename: source_6.csv
Sample Rows in Markdown:
|   Gender_Female |   Gender_Male |
|----------------:|--------------:|
|               1 |             0 |
|               0 |             1 |
|               0 |             1 |
|               1 |             0 |
|               0 |             1 |
|               0 |             1 |
|               1 |             0 |
|               0 |             1 |
|               0 |             1 |
|               0 |             1 |


Target Schema:
|   BusinessTravel_Non-Travel |   BusinessTravel_Travel_Frequently |   BusinessTravel_Travel_Rarely | Department_Human Resources   | Department_Research & Development   | Department_Sales   | EducationField_Human Resources   | EducationField_Life Sciences   | EducationField_Marketing   | EducationField_Medical   | EducationField_Other   | EducationField_Technical Degree   | Gender_Female   | Gender_Male   | JobRole_Healthcare Representative   | JobRole_Human Resources   | JobRole_Laboratory Technician   | JobRole_Manager   | JobRole_Manufacturing Director   | JobRole_Research Director   | JobRole_Research Scientist   | JobRole_Sales Executive   | JobRole_Sales Representative   | MaritalStatus_Divorced   | MaritalStatus_Married   | MaritalStatus_Single   | OverTime_No   | OverTime_Yes   |
|----------------------------:|-----------------------------------:|-------------------------------:|:-----------------------------|:------------------------------------|:-------------------|:---------------------------------|:-------------------------------|:---------------------------|:-------------------------|:-----------------------|:----------------------------------|:----------------|:--------------|:------------------------------------|:--------------------------|:--------------------------------|:------------------|:---------------------------------|:----------------------------|:-----------------------------|:--------------------------|:-------------------------------|:-------------------------|:------------------------|:-----------------------|:--------------|:---------------|
|                           0 |                                  0 |                              1 |                              |                                     |                    |                                  |                                |                            |                          |                        |                                   |                 |               |                                     |                           |                                 |                   |                                  |                             |                              |                           |                                |                          |                         |                        |               |                |
|                           0 |                                  1 |                              0 |                              |                                     |                    |                                  |                                |                            |                          |                        |                                   |                 |               |                                     |                           |                                 |                   |                                  |                             |                              |                           |                                |                          |                         |                        |               |                |
|                           0 |                                  0 |                              1 |                              |                                     |                    |                                  |                                |                            |                          |                        |                                   |                 |               |                                     |                           |                                 |                   |                                  |                             |                              |                           |                                |                          |                         |                        |               |                |
|                           0 |                                  1 |                              0 |                              |                                     |                    |                                  |                                |                            |                          |                        |                                   |                 |               |                                     |                           |                                 |                   |                                  |                             |                              |                           |                                |                          |                         |                        |               |                |
|                           0 |                                  0 |                              1 |                              |                                     |                    |                                  |                                |                            |                          |                        |                                   |                 |               |                                     |                           |                                 |                   |                                  |                             |                              |                           |                                |                          |                         |                        |               |                |
|                           0 |                                  1 |                              0 |                              |                                     |                    |                                  |                                |                            |                          |                        |                                   |                 |               |                                     |                           |                                 |                   |                                  |                             |                              |                           |                                |                          |                         |                        |               |                |
|                           0 |                                  0 |                              1 |                              |                                     |                    |                                  |                                |                            |                          |                        |                                   |                 |               |                                     |                           |                                 |                   |                                  |                             |                              |                           |                                |                          |                         |                        |               |                |
|                           0 |                                  0 |                              1 |                              |                                     |                    |                                  |                                |                            |                          |                        |                                   |                 |               |                                     |                           |                                 |                   |                                  |                             |                              |                           |                                |                          |                         |                        |               |                |
|                           0 |                                  1 |                              0 |                              |                                     |                    |                                  |                                |                            |                          |                        |                                   |                 |               |                                     |                           |                                 |                   |                                  |                             |                              |                           |                                |                          |                         |                        |               |                |
|                           0 |                                  0 |                              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
source_3.csv
source_4.csv
source_5.csv
source_6.csv
test: test_0.csv
test_1.csv
test_2.csv
test_3.csv
test_4.csv
test_5.csv
test_6.csv