<jupyter_start><jupyter_text><jupyter_code>import csv
import pandas as pd
import numpy as np
import datetime
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sb
!git clone https://github.com/AGoyal0512/Madison-Crime.git
data = pd.read_csv('Madison-Crime/cleaned_df.csv.zip', compression='zip')
data
data['my_dates'] = pd.to_datetime(data[['Year','Month', 'Day']])

data['day_of_week'] = data['my_dates'].dt.day_name()

# data['weekday'] = datetime.date(data['Year','Month', 'Day'])
is_rob=data['IncidentType']=="Robbery"
rob= data[is_rob]
rob=rob[['Hour','day_of_week','IncidentType']]
rob
new=rob.groupby(['Hour','day_of_week'])["IncidentType"].count().unstack()
new
fig, ax = plt.subplots(figsize=(11, 9))
sb.heatmap(new,cmap="Blues")
plt.show()
is_vio=data['IncidentType']=="Weapons Violation"
vio= data[is_vio]
vio=vio[['Hour','day_of_week','IncidentType']]
vio
new1=vio.groupby(['Hour','day_of_week'])["IncidentType"].count().unstack()
new1
fig, ax = plt.subplots(figsize=(11, 9))
sb.heatmap(new1,cmap="Blues")
plt.show()
is_bat=data['IncidentType']=="Battery"
bat= data[is_bat]
bat=bat[['Hour','day_of_week','IncidentType']]
bat
new2=bat.groupby(['Hour','day_of_week'])["IncidentType"].count().unstack()
new2
fig, ax = plt.subplots(figsize=(11, 9))
sb.heatmap(new2,cmap="Blues")
plt.show()
is_thef=data['IncidentType']=="Theft"
thef= data[is_thef]
thef=thef[['Hour','day_of_week','IncidentType']]
thef
new3=thef.groupby(['Hour','day_of_week'])["IncidentType"].count().unstack()
new3
fig, ax = plt.subplots(figsize=(11, 9))
sb.heatmap(new3,cmap="Blues")
plt.show()
is_burg=data['IncidentType']=="Residential Burglary"
burg= data[is_burg]
burg=burg[['Hour','day_of_week','IncidentType']]
burg
new4=burg.groupby(['Hour','day_of_week'])["IncidentType"].count().unstack()
new4
fig, ax = plt.subplots(figsize=(11, 9))
sb.heatmap(new4,cmap="Blues")
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.21529596647459404, 'fraction_numerical': 0.016238868517548456, 'mean_word_length': 10.575757575757576, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '512504', 'license': 'Apache-2.0', 'n_tokens_mistral': 831, 'n_tokens_neox': 790, 'n_words': 106, 'path': 'Heat Maps-Time Exploration.ipynb', 'repo_name': 'AGoyal0512/Madison-Crime', 'size': '1909'}