Skip to content

Instantly share code, notes, and snippets.

@BenoitDoyon
Created July 30, 2019 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BenoitDoyon/0fac2aa840d6ae80eb112a65f81418b3 to your computer and use it in GitHub Desktop.
Save BenoitDoyon/0fac2aa840d6ae80eb112a65f81418b3 to your computer and use it in GitHub Desktop.
def main(req: func.HttpRequest) -> func.HttpResponse:
req_body = req.get_json()
df = pd.DataFrame(req_body["data"])
prophet = Prophet(seasonality_mode='multiplicative')
prophet.fit(df)
periods = 2
future = prophet.make_future_dataframe(periods=periods, freq='M')
forecast = prophet.predict(future)
response = forecast['yhat'].tolist()[-periods:]
return func.HttpResponse(json.dumps(response))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment