Skip to content
Binary file not shown.
4,619 changes: 3,773 additions & 846 deletions Notebooks/02_data_wrangling.ipynb

Large diffs are not rendered by default.

1,818 changes: 1,300 additions & 518 deletions Notebooks/03_exploratory_data_analysis.ipynb

Large diffs are not rendered by default.

3,936 changes: 3,530 additions & 406 deletions Notebooks/04_preprocessing_and_training.ipynb

Large diffs are not rendered by default.

1,146 changes: 1,009 additions & 137 deletions Notebooks/05_modeling.ipynb

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions Notebooks/Untitled.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 5
}
59 changes: 59 additions & 0 deletions Notebooks/sb_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import pandas as pd
import os
import pickle


# This utility was created because students were getting confused when they ran
# their notebooks twice, the previous write-to-file code would do nothing and say
# nothing. The students thought the file was over-written when in fact, it was not -
# generating hidden bugs in subsequent notebooks.

def save_file(data, fname, dname):
"""Save a datafile (data) to a specific location (dname) and filename (fname)

Currently valid formats are limited to CSV or PKL."""

if not os.path.exists(dname):
os.mkdir(dname)
print(f'Directory {dname} was created.')

fpath = os.path.join(dname, fname)


if os.path.exists(fpath):
print("A file already exists with this name.\n")

yesno = None
while yesno != "Y" and yesno != "N":
yesno = input('Do you want to overwrite? (Y/N)').strip()[0].capitalize()
if yesno == "Y":
print(f'Writing file. "{fpath}"')
_save_file(data, fpath)
break # Not required
elif yesno == "N":
print('\nPlease re-run this cell with a new filename.')
break # Not required
else:
print('\nUnknown input, please enter "Y" or "N".')

else: # path does not exist, ok to save the file
print(f'Writing file. "{fpath}"')
_save_file(data, fpath)






def _save_file(data, fpath):
valid_ftypes = ['.csv', '.pkl']

assert (fpath[-4:] in valid_ftypes), "Invalid file type. Use '.csv' or '.pkl'"

# Figure out what kind of file we're dealing with by name
if fpath[-3:] == 'csv':
data.to_csv(fpath, index=False)
elif fpath[-3:] == 'pkl':
with open(fpath, 'wb') as f:
pickle.dump(data, f)

278 changes: 278 additions & 0 deletions data/ski_data_cleaned.csv

Large diffs are not rendered by default.

278 changes: 278 additions & 0 deletions data/ski_data_step3_features.csv

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions data/state_summary.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
state,resorts_per_state,state_total_skiable_area_ac,state_total_days_open,state_total_terrain_parks,state_total_nightskiing_ac,state_population,state_area_sq_miles
Alaska,3,2280.0,345.0,4.0,580.0,731545,665384
Arizona,2,1577.0,237.0,6.0,80.0,7278717,113990
California,21,25948.0,2738.0,81.0,587.0,39512223,163695
Colorado,22,43682.0,3258.0,74.0,428.0,5758736,104094
Connecticut,5,358.0,353.0,10.0,256.0,3565278,5543
Idaho,12,16396.0,1136.0,27.0,415.0,1787065,83569
Illinois,4,191.0,221.0,6.0,191.0,12671821,57914
Indiana,2,165.0,157.0,4.0,165.0,6732219,36420
Iowa,3,140.0,100.0,5.0,140.0,3155070,56273
Maine,9,3216.0,865.0,17.0,388.0,1344212,35380
Maryland,1,172.0,121.0,3.0,118.0,6045680,12406
Massachusetts,11,1166.0,671.0,18.0,583.0,6892503,10554
Michigan,28,4406.0,2389.0,63.0,1946.0,9986857,96714
Minnesota,14,1560.0,1490.0,29.0,1020.0,5639632,86936
Missouri,2,60.0,69.0,2.0,47.0,6137428,69707
Montana,12,21410.0,951.0,27.0,710.0,1068778,147040
Nevada,4,2110.0,415.0,9.0,0.0,3080156,110572
New Hampshire,16,3427.0,1847.0,43.0,376.0,1359711,9349
New Jersey,2,190.0,170.0,4.0,181.0,8882190,8723
New Mexico,9,5223.0,966.0,18.0,50.0,2096829,121590
New York,33,5514.0,2384.0,72.0,2836.0,19453561,54555
North Carolina,6,370.0,506.0,9.0,335.0,10488084,53819
Ohio,5,421.0,489.0,12.0,421.0,11689100,44826
Oregon,10,11774.0,1180.0,22.0,1127.0,4217737,98379
Pennsylvania,19,1888.0,1404.0,47.0,1528.0,12801989,46054
Rhode Island,1,30.0,100.0,1.0,30.0,1059361,1545
South Dakota,2,950.0,183.0,3.0,0.0,884659,77116
Tennessee,1,0.0,83.0,1.0,0.0,6829174,42144
Utah,13,30508.0,1544.0,26.0,642.0,3205958,84897
Vermont,15,7239.0,1777.0,50.0,50.0,623989,9616
Virginia,4,269.0,366.0,4.0,135.0,8535519,42775
Washington,10,15330.0,1022.0,21.0,1997.0,7614893,71298
West Virginia,4,542.0,342.0,9.0,187.0,1792147,24230
Wisconsin,15,1750.0,1519.0,40.0,1065.0,5822434,65496
Wyoming,8,6523.0,716.0,14.0,110.0,578759,97813
Binary file added models/ski_resort_pricing_model.pkl
Binary file not shown.