Skip to content

Instantly share code, notes, and snippets.

@dottyz
Created May 2, 2019 18:36
Show Gist options
  • Save dottyz/53db9594e908bfe7d7c3b044db5583b9 to your computer and use it in GitHub Desktop.
Save dottyz/53db9594e908bfe7d7c3b044db5583b9 to your computer and use it in GitHub Desktop.
import datetime as dt
import re
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from geopy import distance
from pandas.api.types import CategoricalDtype
# Create the day of week Category by iterrating over 7 days (March 4th, 2019 is a Monday)
days = [(dt.datetime(2019, 3, 4) + dt.timedelta(days=x)).strftime('%a') for x in range(0, 7)]
day_type = CategoricalDtype(categories=days, ordered=True)
# Create the month Category by iterrating over the months
months = [dt.datetime(2019, x, 1).strftime('%B') for x in range(1, 13)]
month_type = CategoricalDtype(categories=months, ordered=True)
df = pd.read_csv('./data/bikeshare_ridership.csv')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment