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:
| facid   | fac_type   |   capacity | fac_name                           | fac_address             | city_state_zip         | owner                                        | operator                          |
|:--------|:-----------|-----------:|:-----------------------------------|:------------------------|:-----------------------|:---------------------------------------------|:----------------------------------|
| 50R369  | RCF        |         40 | Hillside Care Manor                | 800 NW 25th Avenue      | Portland, OR 97210     | Peaks and Valleys, LLC                       | Peaks and Valleys, LLC            |
| 50R370  | RCF        |         16 | Roxy Ann Memory Community          | 2530 Lone Pine Road     | Medford, OR 97504      | Roxy Ann Memory Community, LLC               | Roxy Ann Memory Community, LLC    |
| 50R371  | RCF        |         15 | Applegate House of Grants Pass     | 1635 Kellenbeck Avenue  | Grants Pass, OR 97528  | Pacific Living Centers, Inc.                 | Pacific Living Centers, Inc.      |
| 50R372  | RCF        |         16 | Kinsington Place                   | 827 SW Kinsington Court | Grants Pass, OR 97526  | Heirloom Living Centers, LLC                 | Heirloom Living Centers, LLC      |
| 50R373  | RCF        |         20 | Silver Creek Memory Care Community | 703 Evergreen Rd.       | Woodburn, OR 97071     | FC Ranger OPS Silver Creek(OR), LLC          | Silver Creek Care Properties, LLC |
| 50R374  | RCF        |         40 | Revere Court of Portland           | 11547 NE Glisan Street  | Portland, OR 97220     | Chancellor Health Care of California X, Inc. | Chancellor Health Care, Inc,      |
| 50R375  | RCF        |         45 | RN Villa Care Center               | 401 NE 139th Avenue     | Portland, OR 97230     | RN Villa Care Center, LLC                    | RN Villa Care Center, LLC         |
| 50R376  | RCF        |         22 | Hawthorne House                    | 2635 21st Avenue        | Forest Grove, OR 97116 | Hawthorne House, LLC                         | Caring Places Management, LLC     |
| 50R377  | RCF        |         32 | Footsteps at Clackamas Woods       | 14314 SE Webster Road   | Milwaukie, OR 97267    | TSL Clack OPS, LLC                           | The Springs Living, LLC           |
| 50R378  | RCF        |         60 | Adara Oaks Manor                   | 931 NE Linden Avenue    | Gresham, OR 97030      | Adara Oaks Manor, LLC                        | Adara Oaks Manor, LLC             |


Target Schema:
| fac_type   |   capacity |
|:-----------|-----------:|
| NF         |      11201 |
| RCF        |       7136 |

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