<jupyter_start><jupyter_text>**Misdemeanor Amounts New York City**=============================Data Bootcamp Final Project (Fall 2016)by <NAME> (<EMAIL>) **About this project**There's been much discussion in New York about the city's fluctuating amount of petty crime under Mayor Michael Bloomberg. Using publicly available data from the City of New York's website, I wanted to check and see if there really was a change in petty crime over the course of his three terms as Mayor of New York City. For the purposes of this project, I chose to consider only the rate of misdemeanors in New York City as representative of petty crime.** Importing packages and data **I began by importing a variety of Python packages that would allow me to properly plot and analyze the data found on the City's website. I then imported the data found on the City of New York's data website: https://data.cityofnewyork.us/Public-Safety/Historical-New-York-City-Crime-Data/hqhv-9zeg.That dataset includes a variety of crime data on not only misdemeanors but also on felonies and violation offenses. For this project, I'll only be examining the file called *Misdemeanor Offenses 2000-2011.xls*<jupyter_code># import packages 
import pandas as pd                   
import matplotlib.pyplot as plt       
import sys 
from itertools import cycle, islice
import math
import numpy as np
%matplotlib inline<jupyter_output><empty_output><jupyter_text>After importing the required packages, I then imported the data I previously downloaded. For the below code, replace the pathway to the excel spreadsheet with its location on your computer. For the sake of convinience, I created a CSV file from the data so that it would be easier to work with directly.<jupyter_code>path = '/Users/zak/Dropbox/*Classes Fall 2016/Data Bootcamp/Misdemeanor Data.csv'
data = pd.read_csv(path)
data.columns<jupyter_output><empty_output><jupyter_text>This gives us a sense for the data we have to work with: at both the individual offense and total offenses levels, we have data on the number of offenses from 2000-2011. Because this doesn't fully cover Mayor Bloomberg's third term in office (which began in 2010 and ended in 2013), we'll only be examining his first two terms in office: 2002 through 2009. ** Plotting the total number of offenses during Mayor Bloomberg's two terms **To begin with, I'll plot all of the petty crimes committed in New York over the full period of the dataset. The following labels apply to the below numbers on the graph:0 MISDEMEANOR POSSESSION OF STOLEN PROPERTY1 MISDEMEANOR SEX CRIMES (4)2 MISDEMEANOR DANGEROUS DRUGS (1)3 MISDEMEANOR DANGEROUS WEAPONS (5)4 PETIT LARCENY5 ASSAULT 3 & RELATED OFFENSES6 INTOXICATED & IMPAIRED DRIVING7 VEHICLE AND TRAFFIC LAWS8 MISD. CRIMINAL MISCHIEF & RELATED OFFENSES9 CRIMINAL TRESPASS10 UNAUTHORIZED USE OF A VEHICLE11 OFFENSES AGAINST THE PERSON (7)12 OFFENSES AGAINST PUBLIC ADMINISTRATION (2)13 ADMINISTRATIVE CODE (6)14 FRAUDS (3)15 AGGRAVATED HARASSMENT 216 OTHER MISDEMEANORS (8)17 TOTAL MISDEMEANOR OFFENSESThen, I'll plot the total number of crimes over the years 2002-2009. That will give us a baseline idea of the total amount of crime in the city of New York over those years.<jupyter_code>data.plot(kind ='bar')
path = '/Users/zak/Dropbox/*Classes Fall 2016/Data Bootcamp/Misdemeanor Data.csv'
newdata = pd.read_csv(path, skiprows = 0-17, usecols = [3,4,5,6,7,8,9,10])
newd1 = newdata.transpose()
newd1.plot(kind='bar')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.06504297994269341, 'fraction_numerical': 0.029512893982808024, 'mean_word_length': 5.113835376532399, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '594035', 'license': 'MIT', 'n_tokens_mistral': 1135, 'n_tokens_neox': 999, 'n_words': 477, 'path': 'UG_F16/Kukoff-NYC.ipynb', 'repo_name': 'NYUDataBootcamp/Projects', 'size': '3501'}