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:
|   average_covered_charges |   average_medicare_payments |   average_total_payments | drg_definition                                                    | hospital_referral_region_hrr_description   | provider_city    |   provider_id | provider_name                      | provider_state   | provider_street_address                      |   provider_zip_code |   total_discharges |
|--------------------------:|----------------------------:|-------------------------:|:------------------------------------------------------------------|:-------------------------------------------|:-----------------|--------------:|:-----------------------------------|:-----------------|:---------------------------------------------|--------------------:|-------------------:|
|                   5271.47 |                     3713.23 |                  4938.05 | 390 - G.I. OBSTRUCTION W/O CC/MCC                                 | DC - Washington                            | ANNAPOLIS        |        210023 | ANNE ARUNDEL MEDICAL CENTER        | MD               | 2001 MEDICAL PARKWAY                         |               21401 |                 43 |
|                  19179.4  |                     5350.21 |                  6518.07 | 689 - KIDNEY & URINARY TRACT INFECTIONS W MCC                     | WV - Charleston                            | SOUTH CHARLESTON |        510029 | THOMAS MEMORIAL HOSPITAL           | WV               | 4605 MACCORKLE AVE SW                        |               25309 |                 29 |
|                  32241.7  |                     3790.22 |                  4762.89 | 309 - CARDIAC ARRHYTHMIA & CONDUCTION DISORDERS W CC              | FL - Pensacola                             | MILTON           |        100124 | SANTA ROSA MEDICAL CENTER          | FL               | 6002 BERRYHILL RD                            |               32570 |                 18 |
|                 126189    |                    15057.8  |                 17324.8  | 253 - OTHER VASCULAR PROCEDURES W CC                              | FL - Bradenton                             | BRADENTON        |        100035 | MANATEE MEMORIAL HOSPITAL          | FL               | 206 2ND ST E                                 |               34208 |                 27 |
|                  42889.3  |                    11494.3  |                 14394.3  | 208 - RESPIRATORY SYSTEM DIAGNOSIS W VENTILATOR SUPPORT <96 HOURS | NY - Elmira                                | UTICA            |        330044 | FAXTON-ST LUKE'S HEALTHCARE        | NY               | 1656 CHAMPLIN AVENUE                         |               13503 |                 33 |
|                  86781    |                     6795.28 |                  7721.72 | 189 - PULMONARY EDEMA & RESPIRATORY FAILURE                       | PA - Reading                               | POTTSTOWN        |        390123 | POTTSTOWN MEMORIAL MEDICAL CENTER  | PA               | 1600 EAST HIGH STREET AND ARMAND HAMMER BLVD |               19464 |                 39 |
|                  69452.4  |                    15873.1  |                 18390.8  | 243 - PERMANENT CARDIAC PACEMAKER IMPLANT W CC                    | WA - Seattle                               | BREMERTON        |        500039 | HARRISON MEMORIAL HOSPITAL         | WA               | 2520 CHERRY AVENUE                           |               98310 |                 25 |
|                  19869.7  |                     3966.93 |                  5344.53 | 195 - SIMPLE PNEUMONIA & PLEURISY W/O CC/MCC                      | IL - Blue Island                           | OLYMPIA FIELDS   |        140172 | FRANCISCAN ST JAMES HEALTH         | IL               | 20201 S CRAWFORD AVENUE                      |               60461 |                 15 |
|                  20637.2  |                     4814.76 |                  5900.95 | 292 - HEART FAILURE & SHOCK W CC                                  | MS - Oxford                                | OXFORD           |        250034 | BAPTIST MEMORIAL HOSPITAL NORTH MS | MS               | 2301 SOUTH LAMAR                             |               38655 |                 55 |
|                  20996.4  |                     5477.5  |                  7490.56 | 086 - TRAUMATIC STUPOR & COMA, COMA <1 HR W CC                    | PA - Johnstown                             | JOHNSTOWN        |        390110 | MEMORIAL MEDICAL CENTER            | PA               | 1086 FRANKLIN STREET                         |               15905 |                 16 |


Target Schema:
|   provider_id | provider_name                    |   provider_zip_code |   average_covered_charges |   average_total_payments |   average_medicare_payments |
|--------------:|:---------------------------------|--------------------:|--------------------------:|-------------------------:|----------------------------:|
|         10001 | SOUTHEAST ALABAMA MEDICAL CENTER |               36301 |                   40094.6 |                  8723.36 |                     7548.51 |
|         10005 | MARSHALL MEDICAL CENTER SOUTH    |               35957 |                   15449.5 |                  6714.68 |                     5425    |
|         10006 | ELIZA COFFEE MEMORIAL HOSPITAL   |               35631 |                   41302.5 |                  8375.29 |                     7100.68 |
|         10007 | MIZELL MEMORIAL HOSPITAL         |               36467 |                   14937.9 |                  5746.17 |                     4871.56 |
|         10008 | CRENSHAW COMMUNITY HOSPITAL      |               36049 |                   12837.2 |                  5306.81 |                     4357.29 |
|         10011 | ST VINCENT'S EAST                |               35235 |                   54959.8 |                 12098.8  |                    10686    |
|         10012 | DEKALB REGIONAL MEDICAL CENTER   |               35968 |                   39545.4 |                  5797.71 |                     4555.33 |
|         10016 | SHELBY BAPTIST MEDICAL CENTER    |               35007 |                   53113.4 |                 10255.7  |                     8492.42 |
|         10018 | CALLAHAN EYE HOSPITAL            |               35233 |                   31023.7 |                 10373.7  |                     8139.31 |
|         10019 | HELEN KELLER MEMORIAL HOSPITAL   |               35660 |                   29713.6 |                  8860.82 |                     7610.77 |

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