Spaces:
Running
Running
File size: 512 Bytes
a576faa 3563d85 a576faa 3563d85 a576faa 3563d85 a576faa |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import pandas as pd
import openpyxl
def preprocess_whisp_data(response):
# Retrieve response
whisp_response = pd.DataFrame(response['properties'])
whisp_response = whisp_response.melt(var_name="Column", value_name="Value")
# Load metadata
whisp_metadata = pd.read_excel('././data/whisp_columns.xlsx')
# Merge datasets
full_df = pd.DataFrame(whisp_response).merge(whisp_metadata, left_on="Column", right_on="Column name").drop(columns={"Column name"})
return full_df
|