This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| import matplotlib.ticker as ticker | |
| from src.models.coupon_distribution import * | |
| # Initialize CouponDistribution object and load data | |
| coupon_dist = CouponDistribution() | |
| coupon_dist.load_data( | |
| customer_data_path="./data/external/customers.csv", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| A module to do optimization for planning coupon distritbuion. | |
| """ | |
| import sys | |
| import time | |
| from typing import Tuple, Union | |
| import logging | |
| import pandas as pd | |
| import pulp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import datetime | |
| import gspread | |
| import urllib.request | |
| import pandas as pd | |
| from flask import Flask | |
| FRT = datetime.timezone(datetime.timedelta(hours=+2)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| web: gunicorn app:app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pandas==0.25.3 | |
| gspread==3.6.0 | |
| urllib3==1.24.3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import datetime | |
| import gspread | |
| import urllib.request | |
| import pandas as pd | |
| event = "Arrived at office." # Whatever event you want to record in the sheet. | |
| FRT = datetime.timezone(datetime.timedelta(hours=+2)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| google-auth==1.20.1 | |
| google-cloud-bigquery==1.27.2 | |
| google-cloud-bigquery-storage==1.0.0 | |
| oauth2client==4.1.3 | |
| pandas==0.25.3 | |
| pandas-gbq==0.13.2 | |
| gspread==3.6.0 | |
| urllib3==1.24.3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import google.auth | |
| from google.cloud import bigquery | |
| from google.cloud import bigquery_storage_v1beta1 | |
| import datetime | |
| import gspread | |
| import urllib.request | |
| from oauth2client.service_account import ServiceAccountCredentials | |
| def nytaxi_pubsub(event, context): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # After getting forecast dataframe using user-defined seasonality "on-season"/"off-season" above... | |
| from statsmodels.graphics.tsaplots import plot_pacf, plot_acf | |
| df['ds'] = pd.to_datetime(df['ds'],format='%Y-%m-%d') | |
| df_res = df.merge(forecast,how="inner",on="ds") | |
| df_res['residual'] = df_res['y'] - df_res['yhat'] | |
| plot_acf(df_res['residual']) | |
| plot_pacf(df_res['residual']) | |
| plt.show() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| from IPython.display import display | |
| from fbprophet import Prophet | |
| from fbprophet.diagnostics import cross_validation, performance_metrics | |
| from fbprophet.plot import add_changepoints_to_plot, plot_cross_validation_metric | |
| # Load test data: log-transformed daily page views for the Wikipedia page for Peyton Manning. | |
| df = pd.read_csv("https://raw.githubusercontent.com/facebook/prophet/master/examples/example_wp_log_peyton_manning.csv") |
NewerOlder