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
from collections import OrderedDict | |
import pandas as pd | |
from dateutil import parser | |
def forecast_ts_model(res, start, end): | |
""" | |
Take a statsmodels.tsa.arima_model.ARIMAResults object | |
and predict (forecast) the timeseries values | |
between the "start" and "end" times, which |
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 json | |
from plotly import __version__ | |
from plotly.offline import download_plotlyjs, init_notebook_mode, iplot | |
from plotly import tools, utils | |
from plotly.graph_objs import Scatter, Marker, Layout, XAxis, YAxis | |
def get_json_for_js(data): | |
figure = tools.return_figure_from_figure_or_data(data, True) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
def plot_table(features, targets): | |
for idx, feature in enumerate(features.columns): | |
grouped = loans.groupby(targets) | |
if idx % 2==0: | |
fig = plt.figure(figsize=(16,4)) | |
plt.subplot(1, 2, idx % 2 + 1) |
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
;; From: | |
;; http://frenchy64.github.io/typed/clojure,/core.typed,/clojure/2013/09/03/core-typed-repl.html | |
(ns example.typed | |
(:require [clojure.core.typed :as t])) | |
(t/cf (t/ann my-inc [Number -> Number])) | |
(t/cf (defn my-inc [a] (inc a))) | |
(t/cf (my-inc 1)) |
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
def conditional_rate(df): | |
""" | |
Given a dataframe whose columns are all boolean | |
valued, return a data frame of size: | |
n_columns * n_columns | |
where the ith row and the jth column represents | |
the rate at which the jth variable is true | |
given that the ith variable is true. | |
""" | |
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
Data and Modeling | |
Boiler plate for manipulating data and modeling using python libraries. |
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
from __future__ import division | |
%matplotlib inline | |
import numpy as np | |
import pandas as pd | |
pd.set_option('display.max_rows', 500) | |
pd.set_option('display.max_columns', 500) |
NewerOlder