Skip to content

Instantly share code, notes, and snippets.

Created June 6, 2020 08:39
What would you like to do?
from pandas import read_csv
crimes_df = read_csv("CrimeData.csv")
crimes_df = crimes_df[crimes_df.year <= "2019"]
days_df = read_csv("DaysData.csv")
from datetime import datetime
def to_weekday(date):
return datetime.strptime(date, "%m/%d/%Y").strftime("%A")
crimes_df["weekday"] =
crimes_count_df = crimes_df \
.groupby(["weekday"]) \
.size() \
.to_frame("crimes") \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment