Aadesh
06-14-2023Data Storage
Quest -Rolling average model
Here I am trying to create a rolling average quest model however Quest fails to load the model when deployed
Here is the code :
from sisense import pandas as pd
import json
def main(event, context):
window = 5
# Format JSON into data frame for easy manipulation
data = event['data']
df = pd.DataFrame()
for col in data:
if col['datatype'] == "numeric":
df[col['name']] = col['values']
# Calculate rolling average
df["rolling"] = df.iloc[:, 0].rolling(window=window).mean()
# Return output in JSON
output = df.to_dict(orient='records')
return output