# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import pandas as pd
import sys
sys.path.append('../parsing')
import accessDB as db
df = db.filter(doGeoLoc=False)

callsPerDay = df.groupby(pd.to_datetime(df['Date/Time']).dt.date)['Call Number'].count()

# %matplotlib inline
maxCalls = callsPerDay.max()
minCalls = callsPerDay.min()
delta = maxCalls - minCalls
colors = [(1 - (calls - minCalls)/delta, (calls - minCalls)/delta, 0) for calls in callsPerDay] # <-- Quick gradient example along the Red/Green dimensions.
callsPerDay.plot(kind='bar', figsize=(40,14), color=colors, title='Calls per Day')

callsPerDay.nsmallest(10)

callsPerDay.describe()

callsPerWeek = df.groupby([pd.to_datetime(df['Date/Time']).dt.year, pd.to_datetime(df['Date/Time']).dt.week])['Call Number'].count()

# %matplotlib inline
maxCalls = callsPerWeek.max()
minCalls = callsPerWeek.min()
delta = maxCalls - minCalls
colors = [(1 - (calls - minCalls)/delta, (calls - minCalls)/delta, 0) for calls in callsPerWeek] # <-- Quick gradient example along the Red/Green dimensions.
callsPerWeek.plot(kind='bar', figsize=(20,7), color=colors, title='Calls per Week')

callsPerHour = df.groupby(pd.to_datetime(df['Date/Time']).dt.hour)['Call Number'].count()
callsPerHour.plot(kind='bar', figsize=(20,7), color=[(0.3, 0.2, 0.7)], title='Calls per Hour')

StarcoderdataJupyterScriptsDedupFiltered