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:
|   Slice n° |   X |   Y |   Distance |   Pixel Value |   ok_col_names |   ok_col_num |   ok_row_num | cop_name   |   day | fname    |
|-----------:|----:|----:|-----------:|--------------:|---------------:|-------------:|-------------:|:-----------|------:|:---------|
|         57 |  52 |  41 |      0     |           141 |              0 |            0 |            0 | 07_1A      |    15 | 07_1A_15 |
|         57 |  84 |  34 |      0     |           187 |              1 |            0 |            0 | 56_4D      |     9 | 56_4D_9  |
|         39 |  19 |  70 |      0.532 |           235 |              1 |            0 |            0 | 38_3B      |    15 | 38_3B_15 |
|         54 |  49 |  11 |      1.847 |            94 |              1 |            0 |            0 | 09_2B      |    13 | 09_2B_13 |
|         55 |  28 |  49 |      0     |           130 |              1 |            0 |            0 | 36_2A      |    15 | 36_2A_15 |
|         12 |  97 |  50 |      4.537 |           139 |              1 |            0 |            0 | 45_2A      |    13 | 45_2A_13 |
|         14 |  33 |  72 |      0     |           176 |              1 |            0 |            0 | 31_5B      |    13 | 31_5B_13 |
|         27 |  82 |  90 |      1.271 |           136 |              1 |            0 |            0 | 03_4D      |    11 | 03_4D_11 |
|         49 |  47 |  96 |      0     |           104 |              1 |            0 |            0 | 66_6B      |     9 | 66_6B_9  |
|         37 |  28 |  24 |      0     |           117 |              0 |            0 |            0 | 34_1A      |     5 | 34_1A_5  |


Target Schema:
| fname    |   count_of_obs |
|:---------|---------------:|
| 01_1D_11 |             24 |
| 01_1D_13 |             24 |
| 01_1D_15 |             24 |
| 01_1D_17 |             20 |
| 01_1D_5  |             19 |
| 01_1D_7  |             26 |
| 01_1D_9  |             17 |
| 01_2B_11 |             22 |
| 01_2B_5  |             27 |
| 01_2B_7  |             18 |

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