Skip to content

Instantly share code, notes, and snippets.

@Akramz
Last active October 25, 2015 02:50
Show Gist options
  • Save Akramz/5eae0eaf86e7eacbb8b4 to your computer and use it in GitHub Desktop.
Save Akramz/5eae0eaf86e7eacbb8b4 to your computer and use it in GitHub Desktop.
import pandas as pd
import numpy as np
import statsmodels.api as sm
from sys import exit
# try whatever you want
listX = ['day_week', 'fog', 'rain', 'weekday']
df = pd.read_csv('../improved_data_set/turnstile_weather_v2.csv', index_col=0)
dk = pd.DataFrame(df.groupby(listX)['ENTRIESn_hourly'].mean().reset_index())
X = dk[listX]
y = dk['ENTRIESn_hourly']
X = sm.add_constant(X)
est = sm.OLS(y, X).fit()
print est.summary()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment