<jupyter_start><jupyter_text>Wake County Fire Incidents - Open Data Portal   Using data from the Wake County Open Data Portal:  - [Fire Incidents](https://data-wake.opendata.arcgis.com/datasets/ral::fire-incidents)  - All EMS-related calls (codes 300-399 and 661) are missing  - The entire month of October 2018 is missing<jupyter_code># Standard notebook setup
import pandas as pd
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
%matplotlib notebook<jupyter_output><empty_output><jupyter_text>Load the Fire Incidents file as a [Pandas](http://pandas.pydata.org/pandas-docs/stable/10min.html) data frame, indexed by dispatch time.<jupyter_code>df = fire_incidents = pd.read_csv('data/Fire_Incidents.csv',
                                  index_col='dispatch_date_time')
print("Loaded", len(df), "incidents")  # 177738<jupyter_output>Loaded 177738 incidents<jupyter_text>Data cleanup and filteringThe raw data needs some work before we can use it.<jupyter_code># Convert index to correct data type
df.index = pd.to_datetime(df.index)

# Sort rows by time, using a stable sort
df.sort_index(inplace=True, kind='mergesort')

# Filter out rows with missing/invalid dispatch times
print(len(df[df.index.notnull()]))  # 176284
df.drop(df.index[sum(df.index.notnull()):], inplace=True)

# Count incidents by month and year
monthly = df.groupby(pd.Grouper(freq='M')).count()
yearly = df.groupby(pd.Grouper(freq='Y')).count()<jupyter_output>176284<jupyter_text>Call Volume by MonthThis graph shows the number of reported fire incidents per month for every month since the data began, except for the last month which usually has incomplete data.<jupyter_code>%matplotlib notebook
text = "Wake County Fire Incidents by Month"
p = monthly['incident_number'][:-1].plot(title=text)
# p = plt.plot(monthly.index, monthly['incident_number'])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10708577517314864, 'fraction_numerical': 0.021310602024507193, 'mean_word_length': 5.589473684210526, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '472160', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 633, 'n_tokens_neox': 601, 'n_words': 171, 'path': 'fire-incidents-open-data-portal.ipynb', 'repo_name': 'dhandy2013/wake-fire-planning', 'size': '1877'}