Kaggle: San Francisco Crime Classification

Improvement as part of sdap17 excercise 3


In [1]:
import pandas as pd
import numpy as np
import pprint
import requests
import gmaps
import gmaps.datasets

Exploration of the training data set


In [43]:
data = pd.read_csv("../../data/raw/henrik/train.csv")
data['Dates'] = pd.to_datetime(data['Dates'])

In [44]:
data.head()


Out[44]:
Dates Category Descript DayOfWeek PdDistrict Resolution Address X Y
0 2015-05-13 23:53:00 WARRANTS WARRANT ARREST Wednesday NORTHERN ARREST, BOOKED OAK ST / LAGUNA ST -122.425892 37.774599
1 2015-05-13 23:53:00 OTHER OFFENSES TRAFFIC VIOLATION ARREST Wednesday NORTHERN ARREST, BOOKED OAK ST / LAGUNA ST -122.425892 37.774599
2 2015-05-13 23:33:00 OTHER OFFENSES TRAFFIC VIOLATION ARREST Wednesday NORTHERN ARREST, BOOKED VANNESS AV / GREENWICH ST -122.424363 37.800414
3 2015-05-13 23:30:00 LARCENY/THEFT GRAND THEFT FROM LOCKED AUTO Wednesday NORTHERN NONE 1500 Block of LOMBARD ST -122.426995 37.800873
4 2015-05-13 23:30:00 LARCENY/THEFT GRAND THEFT FROM LOCKED AUTO Wednesday PARK NONE 100 Block of BRODERICK ST -122.438738 37.771541

In [4]:
data.tail()


Out[4]:
Dates Category Descript DayOfWeek PdDistrict Resolution Address X Y
878044 2003-01-06 00:15:00 ROBBERY ROBBERY ON THE STREET WITH A GUN Monday TARAVAL NONE FARALLONES ST / CAPITOL AV -122.459033 37.714056
878045 2003-01-06 00:01:00 LARCENY/THEFT GRAND THEFT FROM LOCKED AUTO Monday INGLESIDE NONE 600 Block of EDNA ST -122.447364 37.731948
878046 2003-01-06 00:01:00 LARCENY/THEFT GRAND THEFT FROM LOCKED AUTO Monday SOUTHERN NONE 5TH ST / FOLSOM ST -122.403390 37.780266
878047 2003-01-06 00:01:00 VANDALISM MALICIOUS MISCHIEF, VANDALISM OF VEHICLES Monday SOUTHERN NONE TOWNSEND ST / 2ND ST -122.390531 37.780607
878048 2003-01-06 00:01:00 FORGERY/COUNTERFEITING CHECKS, FORGERY (FELONY) Monday BAYVIEW NONE 1800 Block of NEWCOMB AV -122.394926 37.738212

In [5]:
len(data)


Out[5]:
878049

In [7]:
crimes = data['Category'].unique()
pprint.pprint("Crimes: {}, #{}".format(crimes, len(crimes)), indent=2)


("Crimes: ['WARRANTS' 'OTHER OFFENSES' 'LARCENY/THEFT' 'VEHICLE THEFT' "
 "'VANDALISM'\n"
 " 'NON-CRIMINAL' 'ROBBERY' 'ASSAULT' 'WEAPON LAWS' 'BURGLARY'\n"
 " 'SUSPICIOUS OCC' 'DRUNKENNESS' 'FORGERY/COUNTERFEITING' 'DRUG/NARCOTIC'\n"
 " 'STOLEN PROPERTY' 'SECONDARY CODES' 'TRESPASS' 'MISSING PERSON' 'FRAUD'\n"
 " 'KIDNAPPING' 'RUNAWAY' 'DRIVING UNDER THE INFLUENCE'\n"
 " 'SEX OFFENSES FORCIBLE' 'PROSTITUTION' 'DISORDERLY CONDUCT' 'ARSON'\n"
 " 'FAMILY OFFENSES' 'LIQUOR LAWS' 'BRIBERY' 'EMBEZZLEMENT' 'SUICIDE'\n"
 " 'LOITERING' 'SEX OFFENSES NON FORCIBLE' 'EXTORTION' 'GAMBLING'\n"
 " 'BAD CHECKS' 'TREA' 'RECOVERED VEHICLE' 'PORNOGRAPHY/OBSCENE MAT'], #39")

In [8]:
descriptions = data['Descript'].unique()
pprint.pprint("Descriptions: {}, #{}".format(descriptions, len(descriptions)), indent=2)


("Descriptions: ['WARRANT ARREST' 'TRAFFIC VIOLATION ARREST' 'GRAND THEFT FROM "
 "LOCKED AUTO'\n"
 " 'GRAND THEFT FROM UNLOCKED AUTO' 'STOLEN AUTOMOBILE'\n"
 " 'PETTY THEFT FROM LOCKED AUTO' 'MISCELLANEOUS INVESTIGATION'\n"
 " 'MALICIOUS MISCHIEF, VANDALISM OF VEHICLES' 'FOUND PROPERTY'\n"
 " 'ROBBERY, ARMED WITH A KNIFE' 'AGGRAVATED ASSAULT WITH BODILY FORCE'\n"
 " 'TRAFFIC VIOLATION' 'ROBBERY, BODILY FORCE'\n"
 " 'STAY AWAY OR COURT ORDER, NON-DV RELATED' 'LOST PROPERTY'\n"
 " 'ATTEMPTED THEFT FROM LOCKED VEHICLE' 'CIVIL SIDEWALKS, CITATION'\n"
 " 'MALICIOUS MISCHIEF, VANDALISM' 'SUSPICIOUS PACKAGE'\n"
 " 'AIDED CASE, MENTAL DISTURBED' 'PETTY THEFT SHOPLIFTING'\n"
 " 'PROBATION VIOLATION' 'STAY AWAY ORDER VIOLATION, DV RELATED'\n"
 " 'DRIVERS LICENSE, SUSPENDED OR REVOKED' 'STOLEN MOTORCYCLE'\n"
 " 'GRAND THEFT FROM PERSON' 'BURGLARY, VEHICLE (ARREST MADE)'\n"
 " 'ATTEMPTED ROBBERY ON THE STREET WITH BODILY FORCE'\n"
 " 'PETTY THEFT FROM A BUILDING' 'INVESTIGATIVE DETENTION'\n"
 " 'GRAND THEFT OF PROPERTY' 'STOLEN AND RECOVERED VEHICLE'\n"
 " 'UNDER INFLUENCE OF ALCOHOL IN A PUBLIC PLACE' 'ENROUTE TO PAROLE OFFICER'\n"
 " 'ENROUTE TO OUTSIDE JURISDICTION'\n"
 " 'EXHIBITING DEADLY WEAPON IN A THREATING MANNER'\n"
 " 'GRAND THEFT FROM A BUILDING'\n"
 " 'BURGLARY OF RESIDENCE, ATTEMPTED FORCIBLE ENTRY'\n"
 " 'PETTY THEFT OF PROPERTY' 'BURGLARY OF APARTMENT HOUSE, UNLAWFUL ENTRY'\n"
 " 'FORGERY, NOTES' 'CHECKS, POSSESSION WITH INTENT TO PASS'\n"
 " 'BURGLARY,STORE UNDER CONSTRUCTION, UNLAWFUL ENTRY'\n"
 " 'GRAND THEFT SHOPLIFTING' 'POSSESSION OF NARCOTICS PARAPHERNALIA'\n"
 " 'RESISTING ARREST' 'CHILD ABUSE (PHYSICAL)'\n"
 " 'STOLEN PROPERTY, POSSESSION WITH KNOWLEDGE, RECEIVING'\n"
 " 'DOMESTIC VIOLENCE' 'THREATS AGAINST LIFE' 'AIDED CASE' 'TRESPASSING'\n"
 " 'BURGLARY OF HOTEL ROOM, UNLAWFUL ENTRY' 'POSSESSION OF MARIJUANA'\n"
 " 'LOST/STOLEN LICENSE PLATE'\n"
 " 'BURGLARY,BLDG. UNDER CONSTRUCTION, UNLAWFUL ENTRY'\n"
 " 'ROBBERY OF A COMMERCIAL ESTABLISHMENT W/ A KNIFE'\n"
 " 'FORGERY & COUNTERFEITING (GENERAL)'\n"
 " 'FRAUDULENT GAME OR TRICK, OBTAINING MONEY OR PROPERTY' 'STOLEN TRUCK'\n"
 " 'MISSING JUVENILE' 'RECKLESS DRIVING'\n"
 " 'ROBBERY, ARMED WITH A DANGEROUS WEAPON' 'VIOLATION OF RESTRAINING ORDER'\n"
 " 'JUVENILE INVOLVED' 'BATTERY, FORMER SPOUSE OR DATING RELATIONSHIP'\n"
 " 'TRAFFIC ACCIDENT' 'SHOOTING INTO INHABITED DWELLING OR OCCUPIED VEHICLE'\n"
 " 'SUSPICIOUS OCCURRENCE' 'BURGLARY, HOT PROWL, UNLAWFUL ENTRY'\n"
 " 'ENROUTE TO DEPARTMENT OF CORRECTIONS' 'POSSESSION OF MARIJUANA FOR SALES'\n"
 " 'SALE OF MARIJUANA' 'BURGLARY, HOT PROWL, ATTEMPTED FORCIBLE ENTRY'\n"
 " 'VIOLATION OF MUNICIPAL CODE' 'PAROLE VIOLATION' 'BATTERY'\n"
 " 'BURGLARY OF APARTMENT HOUSE, FORCIBLE ENTRY'\n"
 " 'BURGLARY OF RESIDENCE, FORCIBLE ENTRY'\n"
 " 'ROBBERY OF A CHAIN STORE WITH A DANGEROUS WEAPON'\n"
 " 'AGGRAVATED ASSAULT WITH A DEADLY WEAPON' 'POSSESSION OF METH-AMPHETAMINE'\n"
 " 'ROBBERY OF A BANK WITH A DANGEROUS WEAPON' 'BURGLARY, UNLAWFUL ENTRY'\n"
 " 'THEFT OF ANIMALS (GENERAL)' 'AGGRAVATED ASSAULT WITH A KNIFE'\n"
 " 'CREDIT CARD, THEFT BY USE OF' 'AIDED CASE -PROPERTY FOR DESTRUCTION'\n"
 " 'FALSE IMPRISONMENT' 'ROBBERY ON THE STREET, STRONGARM'\n"
 " 'SUSPICIOUS PERSON' 'PETTY THEFT BICYCLE' 'MISSING ADULT' 'FOUND PERSON'\n"
 " 'RUNAWAY' 'LOITERING WHERE NARCOTICS ARE SOLD/USED'\n"
 " 'HARASSING PHONE CALLS' 'INCIDENT ON SCHOOL GROUNDS' 'GRAND THEFT BICYCLE'\n"
 " 'ATTEMPTED THEFT OF A BICYCLE' 'VIOLATION OF PARK CODE'\n"
 " 'ATTEMPTED ROBBERY ON THE STREET W/DEADLY WEAPON'\n"
 " 'ATTEMPTED GRAND THEFT PURSESNATCH' 'ATTEMPTED ROBBERY WITH BODILY FORCE'\n"
 " 'BURGLARY OF STORE, FORCIBLE ENTRY'\n"
 " 'POSSESSION OF BURGLARY TOOLS W/PRIORS' 'KIDNAPPING DURING ROBBERY'\n"
 " 'ROBBERY,  ATM, GUN' 'CONSPIRACY'\n"
 " 'RESTRAINING ORDER NOTIFICATION/SERVICE OF RESTRAINING ORDER'\n"
 " 'AIDED CASE, INJURED PERSON'\n"
 " 'DRIVING WHILE UNDER THE INFLUENCE OF ALCOHOL'\n"
 " 'INFLICT INJURY ON COHABITEE' 'DISCHARGE FIREARM AT AN INHABITED DWELLING'\n"
 " 'ROBBERY OF A CHAIN STORE WITH A GUN' 'PENETRATION, FORCED, WITH OBJECT'\n"
 " 'ORAL COPULATION, UNLAWFUL (ADULT VICTIM)'\n"
 " 'FRAUDULENT USE OF AUTOMATED TELLER CARD' 'ATM RELATED CRIME'\n"
 " 'TAMPERING WITH A VEHICLE' 'FORGERY, CREDIT CARD'\n"
 " 'THEFT OF COMPUTERS OR CELL PHONES' 'AIDED CASE, SICK PERSON'\n"
 " 'ENGAGING IN LEWD CONDUCT - PROSTITUTION RELATED' 'POSSESSION OF HEROIN'\n"
 " 'ASSAULT WITH CAUSTIC CHEMICALS' 'VIOLATION OF MUNICIPAL POLICE CODE'\n"
 " 'BURGLARY, HOT PROWL, FORCIBLE ENTRY'\n"
 " 'MALICIOUS MISCHIEF, BREAKING WINDOWS'\n"
 " 'ATTEMPTED ROBBERY OF A BANK WITH BODILY FORCE' 'FALSE PERSONATION'\n"
 " 'ATTEMPTED ROBBERY WITH A DEADLY WEAPON' 'AGGRAVATED ASSAULT WITH A GUN'\n"
 " 'ASSAULT, AGGRAVATED, W/ GUN'\n"
 " 'POSSESSION OF CONTROLLED SUBSTANCE FOR SALE' 'BURGLARY, FORCIBLE ENTRY'\n"
 " 'GRAND THEFT PICKPOCKET'\n"
 " 'ELDER ADULT OR DEPENDENT ABUSE (NOT EMBEZZLEMENT OR THEFT)'\n"
 " 'BURGLARY OF APARTMENT HOUSE, ATT FORCIBLE ENTRY'\n"
 " 'ROBBERY OF A CHAIN STORE WITH A KNIFE'\n"
 " 'BURGLARY OF STORE, UNLAWFUL ENTRY' 'FIRE REPORT' 'DISTURBING THE PEACE'\n"
 " 'DEATH REPORT, CAUSE UNKNOWN' 'PETTY THEFT FROM UNLOCKED AUTO'\n"
 " 'BURGLARY OF RESIDENCE, UNLAWFUL ENTRY' 'BURGLARY OF FLAT, UNLAWFUL ENTRY'\n"
 " 'MONEY, CHANGING FACE AMOUNT'\n"
 " 'BURGLARY,STORE UNDER CONSTRUCTION, FORCIBLE ENTRY' 'ARSON OF A VEHICLE'\n"
 " 'POSSESSION OF BURGLARY TOOLS' 'BURGLARY, VEHICLE, ATT. (ARREST MADE)'\n"
 " 'TRESPASS WITHIN 30 DAYS OF CREDIBLE THREAT'\n"
 " 'UNDER INFLUENCE OF DRUGS IN A PUBLIC PLACE' 'SODOMY (ADULT VICTIM)'\n"
 " 'BATTERY OF A POLICE OFFICER'\n"
 " 'FORGERY, POSSESSION DRIVERS LICENSE OR ID-CARD'\n"
 " 'MALICIOUS MISCHIEF, GRAFFITI' 'VANDALISM OR GRAFFITI TOOLS, POSSESSION'\n"
 " 'LOCATED PROPERTY' 'POSS OF LOADED FIREARM' 'FALSE PRETENSES, GRAND THEFT'\n"
 " 'CREDIT CARD, THEFT OF' 'AIDED CASE, DOG BITE'\n"
 " 'THEFT FROM MERCHANT OR LIBRARY' 'PROBATION SEARCH'\n"
 " 'ATTEMPTED ROBBERY RESIDENCE WITH BODILY FORCE'\n"
 " 'POSS OF FIREARM BY CONVICTED FELON/ADDICT/ALIEN'\n"
 " 'FIREARM, LOADED, IN VEHICLE, POSSESSION OR USE'\n"
 " 'CARRYING A CONCEALED WEAPON' 'MINOR WITHOUT PROPER PARENTAL CARE'\n"
 " 'FRAUDULENT CREDIT APPLICATION'\n"
 " 'FALSE PERSONATION TO RECEIVE MONEY OR PROPERTY'\n"
 " 'POSSESSION OF CONTROLLED SUBSTANCE' 'SEXUAL BATTERY'\n"
 " 'TRAFFIC COLLISION, HIT & RUN, INJURY' 'COUNTERFEITING, COINS OR NOTES'\n"
 " 'POSSESSION OF BASE/ROCK COCAINE FOR SALE' 'GANG ACTIVITY'\n"
 " 'ATTEMPTED HOMICIDE WITH A GUN' 'SEARCH WARRANT SERVICE' 'CHILD STEALING'\n"
 " 'COURTESY REPORT' 'ATTEMPTED THEFT FROM A BUILDING'\n"
 " 'ENROUTE TO ADULT AUTHORITY' 'CHILD ABUSE, PORNOGRAPHY'\n"
 " 'SUSPICIOUS ACT TOWARDS FEMALE' 'HUMAN TRAFFICKING'\n"
 " 'THEFT OF CHECKS OR CREDIT CARDS' 'AMMUNITION, POSS. BY PROHIBITED PERSON'\n"
 " 'ASSAULT' 'ASSAULT TO RAPE WITH BODILY FORCE' 'CASE CLOSURE'\n"
 " 'ATTEMPTED HOMICIDE WITH BODILY FORCE' 'SHOPLIFTING, FORCE AGAINST AGENT'\n"
 " 'POSSESSION OF HEROIN FOR SALES' 'ARSON'\n"
 " 'MALICIOUS MISCHIEF, ADULT SUSPECT'\n"
 " 'BURGLARY OF WAREHOUSE, FORCIBLE ENTRY' 'POSS OF PROHIBITED WEAPON'\n"
 " 'DISCHARGE FIREARM WITHIN CITY LIMITS' 'OBSCENE PHONE CALLS(S)'\n"
 " 'POSSESSION OF ALCOHOL BY MINOR' 'SALE OF BASE/ROCK COCAINE'\n"
 " 'FIREARM, CARRYING LOADED WITH INTENT TO COMMIT FELONY'\n"
 " 'SALE OF CONTROLLED SUBSTANCE' 'CIVIL SIDEWALKS, WARNING'\n"
 " 'FALSE PRETENSES, PETTY THEFT' 'MALICIOUS MISCHIEF, TIRE SLASHING'\n"
 " 'FORCIBLE RAPE, BODILY FORCE' 'DEFRAUDING AN INNKEEPER'\n"
 " 'ATTEMPTED SHOPLIFTING' 'DEATH REPORT, NATURAL CAUSES'\n"
 " 'ENGAGING IN LEWD ACT' 'LICENSE PLATE, FOUND'\n"
 " 'ROBBERY ON THE STREET WITH A KNIFE' 'ROBBERY, ARMED WITH A GUN'\n"
 " 'ROBBERY OF A CHAIN STORE WITH BODILY FORCE' 'THREATENING PHONE CALL(S)'\n"
 " 'EVADING A POLICE OFFICER RECKLESSLY'\n"
 " 'FIREARM, DISCHARGING AT OCCUPIED BLDG, VEHICLE, OR AIRCRAFT'\n"
 " 'KIDNAPPING, ADULT VICTIM' 'SUSPICIOUS OCCURRENCE, POSSIBLE SHOTS FIRED'\n"
 " 'DEFRAUDING TAXI DRIVER' 'LOST PROPERTY, PETTY THEFT'\n"
 " 'PERMIT VIOLATION, POLICE (GENERAL)' 'ATTEMPTED HOMICIDE WITH A KNIFE'\n"
 " 'CONSUMING ALCOHOL IN PUBLIC VIEW'\n"
 " 'FALSE EVIDENCE OF VEHICLE REGISTRATION' 'DISTURBING THE PEACE, COMMOTION'\n"
 " 'ATTEMPTED THEFT FROM UNLOCKED VEHICLE' 'FALSE FIRE ALARM'\n"
 " 'DOG, STRAY OR VICIOUS' 'THEFT, GRAND, OF FIREARM'\n"
 " 'DISSUADING WITNESS, VICTIM' 'POSS OF TEAR GAS WEAPON'\n"
 " 'INJURY TO TELEGRAPH/TELEPHONE LINES'\n"
 " 'ROBBERY OF A RESIDENCE WITH BODILY FORCE'\n"
 " 'DRIVING WHILE UNDER THE INFLUENCE OF DRUGS'\n"
 " 'ROBBERY ON THE STREET WITH A GUN' 'TRICK AND DEVICE, PETTY THEFT'\n"
 " 'ATTEMPTED ARSON' 'FLAMMABLE OR EXPLOSIVE DEVICE, POSSESSION'\n"
 " 'POSSESSION OF METH-AMPHETAMINE FOR SALE'\n"
 " 'TRANSPORTATION OF METH-AMPHETAMINE' 'GRAND THEFT AUTO STRIP'\n"
 " 'WEAPON, DEADLY, EXHIBITING TO RESIST ARREST'\n"
 " 'THREAT OR FORCE TO RESIST EXECUTIVE OFFICER'\n"
 " 'SELL OR FURNISH ALCOHOL TO INTOXICATED PERSON'\n"
 " 'TRAFFIC COLLISION, HIT & RUN, PROPERTY DAMAGE'\n"
 " 'STOLEN MISCELLANEOUS VEHICLE' 'FALSE ID TO PEACE OFFICER'\n"
 " 'ROBBERY ON THE STREET WITH A DANGEROUS WEAPON'\n"
 " 'CIVIL SIDEWALKS, VIOLATION' 'THREATS TO SCHOOL TEACHERS'\n"
 " 'POSSESSION OF AIR GUN' 'POSSESSION OF BASE/ROCK COCAINE'\n"
 " 'ATTEMPTED MAYHEM WITH A DEADLY WEAPON'\n"
 " 'ROBBERY OF A COMMERCIAL ESTABLISHMENT, STRONGARM'\n"
 " 'BURGLARY,BLDG. UNDER CONSTRUCTION, FORCIBLE ENTRY' 'STALKING'\n"
 " 'CHECKS, MAKE OR PASS FICTITIOUS'\n"
 " 'CHECKS OR LEGAL INSTRUMENTS, UTTERING FORGED'\n"
 " 'SOLICITS FOR ACT OF PROSTITUTION' 'LOITERING FOR PURPOSE OF PROSTITUTION'\n"
 " 'LICENSE PLATE, RECOVERED' 'POSSESSION OF COCAINE FOR SALES'\n"
 " 'TARASOFF REPORT' 'EMBEZZLED VEHICLE'\n"
 " 'FAILURE TO REGISTER AS SEX OFFENDER' 'ROBBERY,  ATM, GUN, ATT.'\n"
 " 'PROBATION VIOLATION, DV RELATED' 'PREJUDICE-BASED INCIDENT'\n"
 " 'DEATH, ACCIDENTAL' 'IMPOUNDED VEHICLE' 'BATTERY WITH SERIOUS INJURIES'\n"
 " 'DISORDERLY HOUSE, KEEPING' 'TRANSPORTATION OF MARIJUANA'\n"
 " 'ATTEMPTED STOLEN VEHICLE'\n"
 " 'VEHICLE ALARM CODE GRABBING DEVICE, POSSESS OR USE'\n"
 " 'CARRYING OF CONCEALED WEAPON BY CONVICTED FELON'\n"
 " 'MAINTAINING A PUBLIC NUISANCE AFTER NOTIFICATION'\n"
 " 'OBSTRUCTIONS ON STREETS/SIDEWALKS'\n"
 " 'VIOLATION OF EMERGENCY PROTECTIVE ORDER' 'MAINTAINING A PUBLIC NUISANCE'\n"
 " 'BURGLARY, ATTEMPTED FORCIBLE ENTRY' 'COMMITTING PUBLIC NUISANCE'\n"
 " 'ANNOY OR MOLEST CHILDREN' 'INDECENT EXPOSURE'\n"
 " 'AGGRAVATED ASSAULT OF POLICE OFFICER,BODILY FORCE'\n"
 " 'ATTEMPTED KIDNAPPING, JUVENILE VICTIM'\n"
 " 'ATTEMPTED GRAND THEFT FROM PERSON' 'ROBBERY OF A RESIDENCE WITH A KNIFE'\n"
 " 'VIOLATION OF STAY AWAY ORDER' 'MISCELLANEOUS STATE FELONY'\n"
 " 'ATTEMPTED SUICIDE' 'PROPERTY FOR IDENTIFICATION'\n"
 " 'PLANTING/CULTIVATING MARIJUANA' 'ACCESS CARD INFORMATION, THEFT OF'\n"
 " 'MISCELLANEOUS STATE MISDEMEANOR' 'SHORT CHANGE, PETTY THEFT'\n"
 " 'THEFT, DRUNK ROLL, <$50' 'KIDNAPPING, JUVENILE VICTIM' 'TRUANT, HABITUAL'\n"
 " 'DISTURBING THE PEACE, FIGHTING' 'SUSPICIOUS AUTO, POSSIBLY SEX'\n"
 " 'BURGLARY,RESIDENCE UNDER CONSTRT, FORCIBLE ENTRY'\n"
 " 'BRIBERY OF EXECUTIVE OFFICER' 'THREATENING SCHOOL OR PUBLIC EMPLOYEE'\n"
 " 'CRUELTY TO ANIMALS' 'BURGLARY OF HOTEL ROOM, FORCIBLE ENTRY'\n"
 " 'LOITERING ABOUT SCHOOL/PLAYGROUND' 'POSSESSION OF COCAINE' 'SPEEDING'\n"
 " 'SCHOOL, PUBLIC, TRESPASS'\n"
 " 'ROBBERY OF A COMMERCIAL ESTABLISHMENT W/ WEAPON'\n"
 " 'ENROUTE TO U.S. MARSHALL'\n"
 " 'ASSAULT ON A POLICE OFFICER WITH A DEADLY WEAPON'\n"
 " 'PETTY THEFT AUTO STRIP' 'ATTEMPTED PETTY THEFT OF PROPERTY'\n"
 " 'ATTEMPTED SIMPLE ASSAULT' 'BURGLARY OF FLAT, FORCIBLE ENTRY'\n"
 " 'COUNTERFEITING, POSSESSION COINS OR NOTES'\n"
 " 'ATTEMPTED ROBBERY ON THE STREET WITH A GUN'\n"
 " 'MALICIOUS MISCHIEF, JUVENILE SUSPECT' 'MAYHEM WITH A KNIFE'\n"
 " 'UNLAWFUL DISSUADING/THREATENING OF A WITNESS'\n"
 " 'DRIVING, RECKLESS, WITH INJURY'\n"
 " 'WEAPON, DEADLY, CARRYING WITH INTENT TO COMMIT ASSAULT'\n"
 " 'OPEN CONTAINER OF ALCOHOL IN VEHICLE'\n"
 " 'RESISTING PEACE OFFICER, CAUSING THEIR SERIOUS INJURY OR DEATH'\n"
 " 'ENROUTE TO PROBATION OFFICER' 'REMAINING ON CAMPUS WITHOUT CONSENT'\n"
 " 'SCHOOL PROPERTY, DISTURBANCE ON'\n"
 " 'WEAPON, POSSESS OR BRING OTHER ON SCHOOL GROUNDS' 'UNUSUAL OCCURENCE'\n"
 " 'FALSE PERSONATION AND CHEAT CRIMES (GENERAL)' 'CURFEW VIOLATION'\n"
 " 'POSSESSION OF HALLUCINOGENIC FOR SALES' 'SALE OF HALLUCINOGENIC'\n"
 " 'CARJACKING WITH A KNIFE' 'KIDNAPPING DURING CARJACKING'\n"
 " 'MAINTAINING PREMISE WHERE NARCOTICS ARE SOLD/USED'\n"
 " 'ARMOR PENETRATING AMMUNITION, POSSESSION'\n"
 " 'POST RELEASE COMMUNITY SUPERVISION' 'FORGE OR ALTER PRESCRIPTION'\n"
 " 'DISCHARGING IN GROSSLY NEGLIGENT MANNER' 'GRAND THEFT PURSESNATCH'\n"
 " 'ATTEMPTED ROBBERY WITH A KNIFE' 'CARJACKING WITH BODILY FORCE'\n"
 " 'CHILD, INFLICTING INJURY RESULTING IN TRAUMATIC CONDITION'\n"
 " 'WEAPON, POSSESSING IN PUBLIC BUILDING OR OPEN MEETING'\n"
 " 'EMBEZZLEMENT FROM DEPENDENT OR ELDER ADULT BY CARETAKER'\n"
 " 'BURGLARY,RESIDENCE UNDER CONSTRT, UNLAWFUL ENTRY' 'AUTO, GRAND THEFT OF'\n"
 " 'DESTITUTE MINOR' 'STOLEN CHECKS, POSSESSION' 'FIRE, UNLAWFULLY CAUSING'\n"
 " 'ROBBERY OF A BANK WITH BODILY FORCE' 'BEYOND PARENTAL CONTROL'\n"
 " 'FIREARMS, SEIZING AT SCENE OF DV'\n"
 " 'FALSE CLAIMS, PRESENTING TO GOVERNMENT' 'TURNED IN GUN'\n"
 " 'LOCATED EXPLOSIVE DEVICE' 'SUICIDE BY JUMPING' 'ANIMAL, FIGHTING'\n"
 " 'ARSON OF AN INHABITED DWELLING'\n"
 " 'BURGLARY,STORE UNDER CONSTRUCTION, ATT. FORCIBLE'\n"
 " 'LOITERING WHILE CARRYING CONCEALED WEAPON'\n"
 " 'DANGER OF LEADING IMMORAL LIFE' 'CHECKS, FORGERY (MISDEMEANOR)'\n"
 " 'DRIVES VEHICLE ALONG TRACK OF RAILROAD' 'TRANSPORTATION OF HEROIN'\n"
 " 'POSSESSION OF OPIATES FOR SALES' 'TRANSPORTATION OF OPIATES'\n"
 " 'DRIVING WHILE UNDER THE INFLUENCE OF ALCOHOL, W/INJURY'\n"
 " 'ATTEMPTED KIDNAPPING, ADULT VICTIM' 'PHONE CALLS, OBSCENE'\n"
 " 'VIOLATION OF FIRE CODE' 'UNLAWFUL SEXUAL INTERCOURSE'\n"
 " 'SUSPICIOUS ACT TOWARDS CHILD' 'SALE OF OPIUM'\n"
 " 'PHONE CALLS IN VIOLATION OF DV COURT ORDER'\n"
 " 'EMBEZZLEMENT, GRAND THEFT BY BROOKERS/AGENTS'\n"
 " 'TRANSPORTAION OF CONTROLLED SUBSTANCE' 'STOLEN TRAILER'\n"
 " 'FALSE REPORT OF EMERGENCY' 'ATTEMPTED ROBBERY CHAIN STORE WITH A KNIFE'\n"
 " 'POSSESSION OF HALLUCINOGENIC' 'THEFT, DRUNK ROLL, $50-$200'\n"
 " 'FAILURE TO PROVIDE FOR CHILD'\n"
 " 'ELECTRICAL  OR GAS LINES, INTERFERING WITH'\n"
 " 'WEAPON, ASSAULT, POSSESSION, MANUFACTURE, OR SALE' 'VIN, ALTER OR REMOVE'\n"
 " 'ATTEMPTED ROBBERY CHAIN STORE WITH BODILY FORCE'\n"
 " 'LODGING WITHOUT PERMISSION' 'LOST PROPERTY, GRAND THEFT'\n"
 " 'ROBBERY,  ATM, FORCE, ATT.'\n"
 " 'CELLULAR OR CORDLESS PHONE COMMUNICATIONS, INTERCEPTING'\n"
 " 'EVADING A POLICE VEHICLE OR BICYCLE' 'EXTORTION'\n"
 " 'LICENSE PLATE OR TAB, THEFT OF' 'PAROLE SEARCH'\n"
 " 'THEFT OF UTILITY SERVICES'\n"
 " 'FIREARM, ARMED WHILE POSSESSING CONTROLLED SUBSTANCE'\n"
 " 'ATTEMPTED MAYHEM WITH BODILY FORCE' 'MAYHEM WITH A DEADLY WEAPON'\n"
 " 'ATTEMPTED HOMICIDE WITH A DANGEROUS WEAPON' 'GAMBLING'\n"
 " 'POSSESSION OF GAMBLING DEVICES' 'SEXUAL ASSAULT, AGGRAVATED, OF CHILD'\n"
 " 'CREDIT CARD, INCOMPLETE OR COUNTERFEIT'\n"
 " 'CONTRIBUTING TO THE DELINQUENCY OF MINOR'\n"
 " 'ATTEMPTED ROBBERY ON THE STREET WITH A KNIFE'\n"
 " 'STOLEN ACCESS CARD, POSSESSION'\n"
 " 'BURGLARY,APT UNDER CONSTRUCTION, UNLAWFUL ENTRY'\n"
 " 'DISTURBING THE PEACE, SWEARING' 'ROBBERY OF A BANK WITH A GUN'\n"
 " 'MALICIOUS MISCHIEF, STREET CARS/BUSES' 'FALSE REPORT OF CRIME'\n"
 " 'SALE OF ALCOHOL TO MINOR'\n"
 " 'MONEY, PROPERTY OR LABOR, FRAUDULENTLY OBTAINING'\n"
 " 'DAMAGE TO PARKING METERS' 'THROWING INJURIOUS SUBSTANCE ON HIGHWAY'\n"
 " 'FIREARM, DISCHARGING IN GROSSLY NEGLIGENT MANNER'\n"
 " 'POSSESSION OF AMPHETAMINE FOR SALES' 'PRIVACY, INVASION OF  (GENERAL)'\n"
 " 'TOBACCO PRODUCTS, SELLING OR FURNISHING TO MINOR'\n"
 " 'EMBEZZLEMENT, PETTY THEFT BY EMPLOYEE' 'IMPERSONATING A POLICE OFFICER'\n"
 " 'TRICK AND DEVICE, ATTEMPTED'\n"
 " 'ROBBERY, VEHICLE FOR HIRE, ATT., W/ OTHER WEAPON'\n"
 " 'ROBBERY OF A BANK WITH A KNIFE'\n"
 " 'THEFT, BICYCLE, <$50, SERIAL NUMBER KNOWN'\n"
 " 'BURGLARY OF STORE, ATTEMPTED FORCIBLE ENTRY'\n"
 " 'SWITCHBLADE KNIFE, POSSESSION'\n"
 " 'WEAPON, ASSAULT, REGISTRATION OR TRANSFER VIOLATION'\n"
 " 'VEHICLE, DISABLED PLACARD VIOLATION' 'POSSESSION OF CAUSTIC CHEMICAL'\n"
 " 'TRANSPORTATION OF COCAINE' 'CHECKS, FORGERY (FELONY)'\n"
 " 'FIREARM, POSSESSION OF WHILE WEARING MASK' 'ROBBERY,  ATM, OTHER WEAPON'\n"
 " 'EMBEZZLEMENT, PETTY THEFT'\n"
 " 'AEROSOL CONTAINER; SALE, PURCHASE OR POSSESSION OF'\n"
 " 'ATTEMPTED ROBBERY COMM. ESTAB. WITH BODILY FORCE'\n"
 " 'IMMORAL ACTS OR DRUNK IN PRESENCE OF CHILD' 'POSSESSION OF METHADONE'\n"
 " 'PUBLIC TRANSIT CRIMES - INFRACTIONS' 'EVADING PAYMENT OF RAILROAD FARE'\n"
 " 'SHELTER' 'INTOXICATED JUVENILE' 'ATTEMPTED EXTORTION'\n"
 " 'ROBBERY OF A COMMERCIAL ESTABLISHMENT WITH A GUN'\n"
 " 'POSSESSION OF ARTICLES WITH IDENTIFICATION REMOVE'\n"
 " 'CHECKS, NON-SUFFICIENT FUNDS (MISDEMEANOR)'\n"
 " 'THEFT, GRAND, BY FIDUCIARY, >$400 IN 12 MONTHS'\n"
 " 'BURGLARY,RESIDENCE UNDER CONSTRT, ATT. FORCIBLE'\n"
 " 'MANUFACTURE OR SALE OF COUNTERFEIT GOODS'\n"
 " 'UNDER THE INFLUENCE OF CONTROLLED SUBSTANCES' 'ROBBERY,  ATM, KNIFE'\n"
 " 'ARSON OF A COMMERCIAL BUILDING'\n"
 " 'STOLEN CELLULAR PHONE, NON-CLONED, POSSESSION'\n"
 " 'MALICIOUS MISCHIEF, BREAKING WINDOWS WITH BB GUN'\n"
 " 'AUDIOVISUAL (VIDEO OR SOUND) RECORDINGS, UNAUTHORIZED'\n"
 " 'STOLEN ELECTRONICS, POSSESSION' 'RAPE, SPOUSAL'\n"
 " 'FORGERY, DRIVERS LICENSE OR ID-CARD' 'WILLFUL CRUELTY TO CHILD'\n"
 " 'FALSIFYING JUDICIAL & PUBLIC RECORDS & DOCUMENTS'\n"
 " 'CASH DISPENSING MACHINES (ATM), LOITERING PROHIBI'\n"
 " 'EMBEZZLEMENT, GRAND THEFT BY EMPLOYEE'\n"
 " 'INDECENT EXPOSURE (JUVENILE VICTIM)' 'CHILD ABUSE SEXUAL'\n"
 " 'CHILDREN, ABANDONMENT & NEGLECT OF (GENERAL)'\n"
 " 'AGGRAVATED ASSAULT ON POLICE OFFICER WITH A KNIFE' 'AUTO IMPOUNDED'\n"
 " 'INTERFERRING WITH A FIREMAN' 'THROWING SUBSTANCE AT VEHICLE'\n"
 " 'TRICK AND DEVICE, GRAND THEFT'\n"
 " 'VANDALISM OR GRAFFITI ON OR WITHIN 100 FT OF HIGHWAY'\n"
 " 'ARSON OF A VACANT BUILDING'\n"
 " 'TRADE SECRETS, THEFT OR UNAUTHORIZED COPYING'\n"
 " 'MINOR PURCHASING OR RECEIVING TOBACCO PRODUCT' 'SALE OF HEROIN'\n"
 " 'EMBEZZLEMENT, GRAND THEFT LEASED PROPERTY' 'VIOLATION OF FEDERAL STATUTE'\n"
 " 'ATTEMPTED RAPE, BODILY FORCE' 'PETTY THEFT COIN OPERATED MACHINE'\n"
 " 'POSSESSION OF OPIATES' 'GRAND THEFT BY PROSTITUTE'\n"
 " 'OTHER OFFENSES AGAINST PUBLIC JUSTICE' 'PEDDLING WITHOUT A LICENSE'\n"
 " 'SALE OF METH-AMPHETAMINE' 'FAILURE TO HEED RED LIGHT AND SIREN'\n"
 " 'SUICIDE BY ASPHYXIATION'\n"
 " 'BURGLARY,HOTEL UNDER CONSTRUCTION, FORCIBLE ENTRY'\n"
 " 'VIOLATION OF RESTRICTIONS ON A FIREARM TRANSFER'\n"
 " 'ATTEMPTED ROBBERY WITH A GUN' 'ORAL COPULATION'\n"
 " 'PERMIT VIOLATION, ENTERTAINMENT' 'CARJACKING WITH A GUN'\n"
 " 'REAL ESTATE FRAUD' 'BURGLARY OF FLAT, ATTEMPTED FORCIBLE ENTRY'\n"
 " 'THREAT TO STATE OFFICIAL OR JUDGE'\n"
 " 'IDENTIFICATION, GOVERNMENT, POSSESS, MAKE OR SELL FALSE'\n"
 " 'ATTEMPTED ROBBERY RESIDENCE WITH A KNIFE'\n"
 " 'INDECENT EXPOSURE WITH PRIOR CONVICTION'\n"
 " 'INTERFERRING WITH A POLICE OFFICER' 'ROBBERY OF A RESIDENCE WITH A GUN'\n"
 " 'MAYHEM WITH BODILY FORCE'\n"
 " 'COMPUTER SYSTEM, ACCESSING, COPYING, OR DAMAGING'\n"
 " 'FORCIBLE RAPE, ARMED WITH A SHARP INSTRUMENT' 'CHILD ABUSE, EXPLOITATION'\n"
 " 'DAMAGE TO MAIL BOX' 'MISCELLANEOUS LIQOUR LAW VIOLATION'\n"
 " 'SALE OF COCAINE' 'ABANDONMENT OF CHILD' 'PLACING TRASH ON THE STREET'\n"
 " 'SPITTING ON SIDEWALK' 'ACTS AGAINST PUBLIC TRANSIT'\n"
 " 'HAZARDOUS MATERIALS, SPILL ON ROADWAY' 'OPERATING TAXI WITHOUT A PERMIT'\n"
 " 'PETTY THEFT WITH PRIOR' 'FALSE REPORT OF BOMB'\n"
 " 'CARJACKING WITH A DANGEROUS WEAPON'\n"
 " 'THROWING OBJECT AT COMMON CARRIER, PASSENGER OR FREIGHT'\n"
 " 'DUMPING OF OFFENSIVE MATTER' 'DEATH, NON-MANSLAUGHTER AUTO ACCIDENT'\n"
 " 'FIREARM WITH ALTERED IDENTIFICATION' 'TAMPERING WITH MARKS ON FIREARM'\n"
 " 'FIREARM POSSESSION IN SCHOOL ZONE' 'PERMIT VIOLATION, VALET PARKING'\n"
 " 'BURGLARY,FLAT UNDER CONSTRUCTION, FORCIBLE ENTRY' 'SODOMY'\n"
 " 'JUDGE/JUROR ACCEPTING A BRIBE'\n"
 " 'TRESPASSING OR LOITERING NEAR POSTED INDUSTRIAL PROPERTY'\n"
 " 'OBSTRUCTING PUBLIC THOROUGHFARE'\n"
 " 'GRAFFITI ON GOVERNMENT VEHICLES OR PUBLIC TRANSPORTATION'\n"
 " 'UNLAWFUL TRANSPORTATION OF ALCOHOL' 'CIVIL SIDEWALKS, BOOKING'\n"
 " 'WEARING MASK OR DISGUISE FOR UNLAWFUL PURPOSE'\n"
 " 'ATTEMPTED SUICIDE BY LACERATION' 'EMBEZZLEMENT (GENERAL)'\n"
 " 'POSSESSION OF FIRECRACKERS'\n"
 " 'POSS OF DEADLY WEAPON WITH INTENT TO ASSAULT'\n"
 " 'BURGLARY,WAREHOUSE UNDER CONSTRT, FORCIBLE ENTRY'\n"
 " 'SAFE BURGLARY OF A HOTEL' 'PRESCRIPTION, FORGE OR ALTER (4390 B&P)'\n"
 " 'THEFT OF WRITTEN INSTRUMENT'\n"
 " 'SEXUAL ASSAULT, ADMINISTERING DRUG TO COMMIT'\n"
 " 'BURGLARY,APT UNDER CONSTRUCTION, FORCIBLE ENTRY'\n"
 " 'ATTEMPTED SUICIDE BY JUMPING' 'AGGRESSIVE SOLICITING' 'HABITUAL TRUANT'\n"
 " 'HYPODERMIC NEEDLE OR SYRINGE, POSSESSION' 'DAMAGE/DESTRUCTION OF MAIL'\n"
 " 'ATTEMPTED ROBBERY OF A BANK WITH A DEADLY WEAPON'\n"
 " 'ATTEMPTED ROBBERY RESIDENCE WITH A GUN' 'BEGGING'\n"
 " 'SAFE BURGLARY OF A STORE' 'EMBEZZLEMENT, GRAND THEFT' 'SALE OF OPIATES'\n"
 " 'PANDERING' 'MALICIOUS MISCHIEF, FICTITIOUS PHONE CALLS'\n"
 " 'PETTY THEFT MOTORCYCLE STRIP' 'THEFT, BOAT'\n"
 " 'CHECKS, NON-SUFFICIENT FUNDS (FELONY)' 'ESCAPE OR ASSISTING ESCAPE'\n"
 " 'ATTEMPTED SUICIDE BY INGESTION' 'TAKING CONTRABAND INTO A REFORMATORY'\n"
 " 'UNLAWFUL ASSEMBLY' 'BURGLARY OF WAREHOUSE, ATTEMPTED FORCIBLE ENTRY'\n"
 " 'ATTEMPTED ROBBERY RESIDENCE WITH A DEADLY WEAPON'\n"
 " 'BURGLARY OF WAREHOUSE, UNLAWFUL ENTRY' 'PIMPING'\n"
 " 'DISRUPTS SCHOOL ACTIVITIES'\n"
 " 'CONCEAL CRIME OR WITHHOLD EVIDENCE, ACCEPTING PAYMENT TO'\n"
 " 'ATTEMPTED ROBBERY COMM. ESTABLISHMENT WITH A GUN'\n"
 " 'DAMAGE TO FIRE ALARM APPARATUS' 'THEFT, DRUNK ROLL, $200-$400'\n"
 " 'STOLEN COMPUTER, POSSESSION' 'THEFT, BICYCLE, <$50, NO SERIAL NUMBER'\n"
 " 'PHONE CALLS, HARASSING, TO 911' 'RIOT' 'DOG, BARKING'\n"
 " 'ATTEMPTED ROBBERY OF A BANK WITH A GUN'\n"
 " 'FAILURE TO REGISTER AS NARCOTICS ADDICT'\n"
 " 'ASSAULT TO COMMIT MAYHEM OR SPECIFIC SEX OFFENSES' 'STOLEN BUS'\n"
 " 'SOLICITING COMMISSION OF A CRIME' 'SALE OF ALCOHOL AFTER HOURS'\n"
 " 'SAFE BURGLARY' 'DOG OR CAT, ABANDONMENT OF'\n"
 " 'MINOR ON ON-SALE LICENSED PREMISE' 'RECEIVING STOLEN PROPERTY'\n"
 " 'FIREARM, NEGLIGENT DISCHARGE' 'EVADING A POLICE OFFICER, INJURY OR DEATH'\n"
 " 'DRIVING WHILE UNDER THE INFLUENCE OF DRUGS, W/INJURY'\n"
 " 'SUICIDE BY STRANGULATION' 'REFUSING TO DISPERSE UPON LAWFUL COMMAND'\n"
 " 'INCITING TO RIOT' 'DESTRUCTION OF PROPERTY WITH EXPLOSIVES'\n"
 " 'FIREWORKS, THROW AT PERSON OR DISCHARGE IN CROWD'\n"
 " 'BURGLARY,FLAT UNDER CONSTRUCTION, UNLAWFUL ENTRY'\n"
 " 'BALLOONS, ELECTRICALLY CONDUCTIVE' 'DESERTION OF CHILD'\n"
 " 'LYNCHING BY RIOT' 'PEEPING TOM' 'FURNISHING MARIJUANA'\n"
 " 'ROBBERY OF A RESIDENCE WITH A DANGEROUS WEAPON'\n"
 " 'ROBBERY OF A SERVICE STATION W/DANGEROUS WEAPON'\n"
 " 'DEFRAUDING OF VEHICLE REPAIRMAN' 'DEATH REPORT, IN CUSTODY'\n"
 " 'LICENSE REQUIRED TO SELL ALCOHOL'\n"
 " 'BURGLARY,BLDG. UNDER CONSTRUCTION, ATT. FORCIBLE'\n"
 " 'COUNTERFEITING, PLATES OR DIES' 'ABORTION' 'SUICIDE BY FIREARMS'\n"
 " 'ATTEMPTED SUICIDE BY STRANGULATION'\n"
 " 'ROBBERY OF A SERVICE STATION WITH A GUN' 'MAYHEM WITH A GUN'\n"
 " 'AID OR HARBOR FELON' 'LOITERING' 'FALSE EVIDENCE OF AGE BY MINOR'\n"
 " 'ANIMAL, WITHOUT PROPER CARE OR ATTENTION' 'GRAND THEFT MOTORCYCLE STRIP'\n"
 " 'ROBBERY OF A SERVICE STATION WITH BODILY FORCE'\n"
 " 'FORCIBLE RAPE, ARMED WITH A GUN'\n"
 " 'SEXUAL CONTACT WITH PATIENT, FORMER PATIENT' 'LICENSE PLATE, STOLEN'\n"
 " 'POSSESSION OF EXPLOSIVE DEVICE'\n"
 " 'INDECENT EXPOSURE - PROSTITUTION RELATED'\n"
 " 'IMPERSONATING FIRE DEPARTMENT MEMBER'\n"
 " 'WEAPON, TAKING OR ATTEMPTING TO TAKE FROM PEACE OFFICER'\n"
 " 'SAFE BURGLARY OF A RESIDENCE' 'INMATE/KEEPER OF HOUSE OF PROSTITUTION'\n"
 " 'ATTEMPTED ROBBERY SERVICE STATION WITH A KNIFE' 'SCALPING TICKETS'\n"
 " 'POSSESSION OF OPIUM DERIVATIVE' 'POSSESSION OF METHADONE FOR SALES'\n"
 " 'ATTEMPTED ROBBERY COMM. ESTAB. WITH DEADLY WEAPON'\n"
 " 'IMPERSONATING PUBLIC UTILITY MEMBER' 'SOLICITS LEWD ACT'\n"
 " 'FORCIBLE RAPE, ARMED WITH A DANGEROUS WEAPON'\n"
 " 'FORGERY, GOVERNMENT OR CORPORATE SEALS'\n"
 " 'ATTEMPTED ROBBERY CHAIN STORE WITH DEADLY WEAPON'\n"
 " 'FOOD STAMPS, MISUSE OF'\n"
 " 'INSURED PROPERTY, DESTRUCTION TO DEFRAUD INSURER'\n"
 " 'VEHICLE, RENTAL, FAILURE TO RETURN'\n"
 " 'DEMONSTRATION, VIDEO EVIDENCE, MISC. INVESTIGATION'\n"
 " 'DISASTER AREA, ENTERING OR REMAINING IN'\n"
 " 'DESTROYING JAIL PROPERTY-OVER $200' 'THEFT, DRUNK ROLL, >$400'\n"
 " 'MASSAGE ESTABLISHMENT PERMIT VIOLATION'\n"
 " 'FALSE REPRESENTATION TO SECONDHAND DEALER'\n"
 " 'DISCHARGING OFFENSIVE OR INJURIOUS SUBSTANCE IN PUBLIC AREA'\n"
 " 'LOITERS AROUND PUBLIC TOILET FOR LEWD ACT'\n"
 " 'VIOLATION OF CIVIL GANG INJUNCTION' 'PERMIT VIOLATION, SIDEWALK SALES'\n"
 " 'TRANSPORTATION OF AMPHETAMINE' 'SUICIDE BY LACERATION'\n"
 " 'DISTURBING RELIGIOUS MEETINGS' 'THEFT, GRAND, AGRICULTURAL'\n"
 " 'LOITERING WITHOUT LAWFUL BUSINESS WITH OWNER OR OCCUPANT'\n"
 " 'ATTEMPTED GRAND THEFT PICKPOCKET' 'SELLING/DISCHARGING OF FIRECRACKERS'\n"
 " 'THEFT, ANIMAL, ATT.' 'ATTEMPTED SUICIDE BY FIRE'\n"
 " 'THEFT OF TELECOMMUNICATION SERVICES, INCL. CLONE PHONE'\n"
 " 'ARSON OF A POLICE BUILDING' 'ADVERTISING DISTRIBUTORS PERMIT VIOLATION'\n"
 " 'CIVIL RIGHTS, INCL. INJURY, THREAT, OR DAMAGE (HATE CRIMES)'\n"
 " 'ENCOURAGING MINOR TO USE MARIJUANA' 'TRESPASSING ON RAILROAD TRAINS'\n"
 " 'CITIZENSHIP DOCUMENT, USING FALSE'\n"
 " 'HAZARDOUS MATERIALS, DUMPING IN UNAUTHORIZED LOCATN' 'SALE OF METHADONE'\n"
 " 'RESCUING PRISONER FROM LAWFUL CUSTODY'\n"
 " 'ASSAULT, AGGRAVATED, ON POLICE OFFICER, W/ GUN'\n"
 " 'FINANCIAL STATEMENTS, FALSE'\n"
 " 'EMBEZZLEMENT, PETTY THEFT PUBLIC/PRIVATE OFFICIAL'\n"
 " 'ILLEGAL TRANSPORTAION OF EXPLOSIVES' 'STOLEN METALS, RECEIVING'\n"
 " 'ASSAULT TO RAPE WITH A GUN' 'ASSAULT BY POLICE OFFICER'\n"
 " 'FALSIFICATION OF MEDICAL RECORDS'\n"
 " 'MALICIOUS MISCHIEF, BUILDING UNDER CONSTRUCTION'\n"
 " 'WEAPONS POSSESSION BY JUVENILE SUSPECT'\n"
 " 'VIOLATION OF CALIF UNEMPLOYMENT INSURANCE ACT'\n"
 " 'LASERS, DISCHARGING OR LIGHTS AT AIRCRAFT'\n"
 " 'ATTEMPTED MAYHEM WITH A KNIFE' 'ATTEMPTED RAPE WITH A GUN'\n"
 " 'HAZARDOUS SUBSTANCES, DEPOSITING' 'SAFE BURGLARY OF AN APARTMENT'\n"
 " 'ACCIDENTAL SHOOTING' 'SCHOOL GROUNDS, ENTRY BY SEX OFFENDER'\n"
 " 'BURGLARY,HOTEL UNDER CONSTRUCTION, UNLAWFUL ENTRY'\n"
 " 'OBSCENE MATTER, DISTRIBUTION TO MINORS' 'POSSESSION OF AMPHETAMINE'\n"
 ' "ASSAULT OR ATTEMPTED MURDER UPON GOV\'T OFFICERS"\n'
 " 'RECOVERED VEHICLE - STOLEN OUTSIDE SF'\n"
 " 'VEHICLE, RECOVERED, CAMPER-HOUSE CAR-MOTOR HOME'\n"
 " 'ATTEMPTED ROBBERY SERVICE STATION W/DEADLY WEAPON'\n"
 " 'VANDALISM WITH NOXIOUS CHEMICAL' 'VEHICLE, RECOVERED, AUTO'\n"
 " 'POSS OF FIREARM SILENCER' 'ESCAPEE, JUVENILE' 'SUICIDE'\n"
 " 'TELEPHONE OR TELEGRAPH MESSAGE, SENDING FALSE'\n"
 " 'POSSESSION OF OPIUM FOR SALES' 'SAFE BURGLARY OF A WAREHOUSE'\n"
 " 'EAVESDROPPING DEVICES, SALE OR USE' 'TAMPERING WITH MAIL'\n"
 " 'BATTERY DURING LABOR DISPUTE' 'VEHICLE, RECOVERED, MOTORCYCLE'\n"
 " 'BURGLARY OF HOTEL ROOM, ATTEMPTED FORCIBLE ENTRY'\n"
 " 'TRANSPORTATION OF METHADONE' 'SELLING RESTRICTED GLUE TO JUVENILES'\n"
 " 'CONTROLLED SUBSTANCE VIOLATION, LOITERING FOR'\n"
 " 'POSSESSION OF GAMBLING PARAPHERNALIA'\n"
 " 'ROBBERY OF A SERVICE STATION WITH A KNIFE'\n"
 " 'GRAND THEFT COIN OPERATED MACHINE'\n"
 " 'ATTEMPTED THEFT COIN OPERATED MACHINE' 'SUICIDE BY DROWNING'\n"
 ' \'POSSESSION OF OPIUM\' "MEGAN\'S LAW NOTIFICATION" \'ATTEMPTED AUTO '
 "STRIP'\n"
 " 'SALES COCAINE BASE/SCHOOLYARD TRAFFICKING ACT VIO'\n"
 " 'ASSAULT TO RAPE WITH A DANGEROUS WEAPON'\n"
 " 'CRIMES AGAINST REVENUE & PROPERTY OF STATE' 'FORTUNE TELLING'\n"
 " 'VISITING WHERE DRUGS ARE USED OR SMOKED' 'ROBBERY,  ATM, KNIFE, ATT.'\n"
 " 'POSSESSION OF OBSCENE MATTER FOR SALE'\n"
 " 'SCHOOL STUDENT OR EMPLOYEE ENTERING  CAMPUS AFTER SUSPENSION OR "
 "DISMISSAL'\n"
 " 'POSSESSION OF OPIUM DERIVATIVE FOR SALES' 'HEATING VIOLATION  APT/HOTEL'\n"
 " 'ASSAULT, AGGRAVATED, ON POLICE OFFICER, W/ SEMI AUTO'\n"
 " 'POSSESSION OF BARBITUATES' 'VIN SWITCH'\n"
 " 'HAZARDOUS MATERIALS, DUMP OIL INTO SEWERS'\n"
 " 'FALSE REPORT OF POLICE MISCONDUCT' 'PETTY THEFT PHONE BOOTH'\n"
 " 'BATHROOM HOLE, LOOKING THROUGH'\n"
 " 'FORGERY, FALSE ENTRIES IN RECORDS OR RETURNS'\n"
 " 'BURGLARY,FLAT UNDER CONSTRUCTION, ATT. FORCIBLE'\n"
 " 'ATTEMPTED SUICIDE BY ASPHYXIATION' 'OPERATING WITHOUT DANCEHALL PERMIT'\n"
 " 'SOLICITS TO VISIT HOUSE OF PROSTITUTION'\n"
 " 'PUBLIC UTILITY INFORMATION, FRAUDULENTLY OBTAINING'\n"
 " 'EMBEZZLEMENT, PETTY THEFT PRIVATE PROPERTY'\n"
 " 'ATTEMPTED RAPE, ARMED WITH A SHARP INSTRUMENT'\n"
 " 'GUIDE DOG, INTERFERING WITH' 'TRANSPORTATION OF HALLUCINOGENIC'\n"
 " 'ACCESS CARD INFORMATION, PUBLICATION OF'\n"
 " 'ASSAULT, AGGRAVATED, W/ MACHINE GUN' 'ASSAULT, AGGRAVATED, W/ SEMI AUTO'\n"
 " 'LODGING IN PARK' 'ESCAPES' 'DRIVING, DRAG RACING' 'PERJURY'\n"
 " 'ASSAULT BY POISONING' 'LOUDSPEAKER OR SOUND TRUCK PERMIT VIOLATION'\n"
 " 'DRUG OFFENDER, PRESENCE  NEAR SCHOOL GROUNDS' 'MISPLACED VEHICLE'\n"
 " 'ESCAPE FROM HOSPITAL WITH FORCE' 'POSSESSION OF MACHINE GUN'\n"
 " 'MONEY OFFENSE RELATED TO NARCOTICS TRAFFICKING' 'KIDNAPPER, POSING AS'\n"
 " 'COMMISSION OF FELONY WHILE ARMED'\n"
 " 'DESTRUCTIVE DEVICE, POSSESSION OF MATERIALS' 'JUVENILE PAROLE VIOLATOR'\n"
 " 'SHORT CHANGE, GRAND THEFT' 'VEHICLE, RECOVERED, OTHER VEHICLE'\n"
 " 'THEFT, DRUNK ROLL, ATT.' 'SALE OF ALCOHOL BY MINOR' 'MALICIOUS MISCHIEF'\n"
 " 'PROCUREMENT, PIMPING, & PANDERING' 'POSSESSION OF BARBITUATES FOR SALES'\n"
 " 'SALE OF ALCOHOL TO MINOR IN BAR'\n"
 " 'HAZARDOUS MATERIALS, DUMPING IN UNAUTHORIZED LOCATION'\n"
 " 'OBSTRUCTING HEALTH FACILITY, PLACE OF WORSHIP, OR SCHOOL'\n"
 " 'POLICE BROADCAST, INTERCEPTION TO COMMIT CRIME'\n"
 " 'ATTEMPTED ROBBERY OF A BANK WITH A KNIFE'\n"
 " 'ATTEMPTED ROBBERY CHAIN STORE WITH A GUN'\n"
 " 'ATTEMPTED ROBBERY COMM. ESTABLISHMENT W/KNIFE'\n"
 " 'ASSAULT, AGGRAVATED, ON POLICE OFFICER, W/ FULL AUTO'\n"
 " 'DISPLAY & SALE OF SPRAY PAINT & MARKER PENS'\n"
 " 'ATTEMPTED RAPE, ARMED WITH A DANGEROUS WEAPON'\n"
 " 'AGGRAVATED ASSAULT ON POLICE OFFICER WITH A GUN' 'BRIBERY OF WITNESSES'\n"
 " 'HAZARDOUS MATERIALS,  DUMP ANY SUBSTANCE INTO WATER'\n"
 " 'DOG, FIGHTING;  OWNING, FIGHTING, OR ATTENDING FIGHT'\n"
 " 'PUTTING SLUGS IN COIN OPERATED MACHINES'\n"
 " 'ATTEMPTED ROBBERY SERVICE STATION W/BODILY FORCE'\n"
 " 'SOLICITING MINOR TO COMMIT FELONY'\n"
 " 'EMBEZZLEMENT, GRAND THEFT BY COLLECTOR' 'POISONING ANIMALS'\n"
 " 'TERRORIZING BY ARSON OR EXPLOSIVE DEVICE'\n"
 " 'WEARING THE APPAREL OF OPPOSITE SEX TO DECEIVE'\n"
 " 'VEHICLE, RECOVERED, MOBILE HOME-TRAILER' 'SALE OF AMPHETAMINE'\n"
 " 'EMBEZZLEMENT, GRAND THEFT PRIVATE PROPERTY'\n"
 " 'BURGLARY,APT UNDER CONSTRUCTION, ATT. FORCIBLE'\n"
 " 'ROBBERY, VEHICLE FOR HIRE, ATT., W/ GUN'\n"
 " 'ASSAULT TO RAPE WITH A SHARP INSTRUMENT' 'MINOR PURCHASING ALCOHOL'\n"
 " 'SUICIDE BY INGESTION' 'HAZARDOUS MATERIALS, SPILL LOAD'\n"
 " 'EMBEZZLEMENT, GRAND THEFT BY PROPERTY CARRIER'\n"
 " 'HAZARDOUS MATERIALS, FAILURE TO COMPLY W/REGULATIONS'\n"
 " 'ROBBERY, VEHICLE FOR HIRE, ATT., W/ FORCE'\n"
 " 'ALCOHOLIC BEVERAGE, PROCURING SALE OF' 'ASSAULT TO ROB WITH BODILY FORCE'\n"
 " 'VIOLATION OF STATE LABOR CODE' 'YOUTH COURT' 'ESCAPE FROM JAIL'\n"
 " 'BATTERY BY JUVENILE SUSPECT'\n"
 " 'BURGLARY,WAREHOUSE UNDER CONSTRT, UNLAWFUL ENTRY'\n"
 " 'ATTEMPTED ROBBERY SERVICE STATION WITH A GUN'\n"
 " 'DRUG LAB APPARATUS, POSSESSION' 'PUSH-CART PEDDLER PERMIT VIOLATION'\n"
 " 'ATTEMPTED SUICIDE BY FIREARMS' 'INCEST'\n"
 " 'ENCOURAGE MINOR TO USE CONTROLLED SUBSTANCE'\n"
 " 'BIGAMY, INCEST, AND THE CRIME AGAINST NATURE (GENERAL)'\n"
 " 'DISTURBANCE OF NON-RELIGIOUS, NON-POLITICAL ASSEMBLY' 'POSS OF FIRE BOMB'\n"
 " 'CITIZENSHIP OR ALIEN REGISTRATION, MAKING FALSE DOCUMENT'\n"
 " 'FAILURE TO PROVIDE FOR PARENTS'\n"
 " 'CABLE TV CONNECTION OR DECODING DEVICE, UNAUTHORIZED'\n"
 " 'SALE OF SATELLITE TELEPHONE NUMBER' 'SNIPER SCOPE, POSSESSION OF'\n"
 " 'TERRORIZING BY MARKING PRIVATE PROPERTY'\n"
 " 'OBSCENE OR LEWD PLAYS/PERFORMANCES'\n"
 " 'ESCAPE OF PRISONER WHILE HOSPITALIZED'\n"
 " 'INJURY TO RAILROADS/RAILROAD BRIDGES' 'OPERATING WITHOUT CABARET PERMIT'\n"
 " 'SALE OF BARBITUATES' 'BOOKMAKING' 'PUTTING SLUGS IN TELEPHONE BOX'\n"
 " 'AFFIXING ADVERTISMENTS TO POLES'\n"
 " 'EMBEZZLEMENT, PETTY THEFT BY BROOKERS/AGENTS' 'ACCIDENTAL BURNS'\n"
 " 'SAFE BURGLARY OF A FLAT' 'SUICIDE BY FIRE'\n"
 " 'PUTTING SLUGS IN PARKING METERS'\n"
 " 'CONCEALMENT/REMOVAL OF CHILD WITHOUT CONSENT'\n"
 " 'ENCOURAGING MINOR TO USE COCAINE' 'ATTEMPTED MOTORCYCLE STRIP'\n"
 " 'ENCOURAGE MINOR TO USE BARBITUATES' 'ARSON OF A POLICE VEHICLE'\n"
 " 'ILLEGAL CHARITABLE SOLICITATIONS' 'OBSCENE MOVIES/ACTS'\n"
 " 'PLACING WIFE IN HOUSE OF PROSTITUTION' 'ATTEMPTED MAYHEM WITH A GUN'\n"
 " 'OVERCHARGING TAXI FARE' 'UNKNOWN COMPLAINT' 'ASSAULT BY JUVENILE SUSPECT'\n"
 " 'UNAUTHORIZED USE OF LOUD SPEAKERS' 'FRAUDULENT AUCTION'\n"
 " 'SALE OF OPIUM DERIVATIVE' 'SAFE BURGLARY OF A WAREHOUSE WITH EXPLOSIVES'\n"
 " 'AGGRAVATED ASSAULT OF POLICE OFFICER, SNIPING'\n"
 " 'BURGLARY,WAREHOUSE UNDER CONSTRT, ATT. FORCIBLE'\n"
 " 'ATTEMPTED HOMICIDE WITH EXPLOSIVES'\n"
 " 'PURCHASE FEMALE FOR THE PURPOSE OF PROSTITUTION'\n"
 " 'GRAND THEFT PHONE BOOTH' 'ATTEMPTED THEFT PHONE BOOTH'\n"
 " 'VEHICLE, RECOVERED, BUS' 'ATTEMPTED SUICIDE BY DROWNING'\n"
 " 'ASSAULT TO ROB BANK WITH A GUN'\n"
 " 'BURGLARY,HOTEL UNDER CONSTRUCTION, ATT. FORCIBLE'\n"
 " 'PLANTING/CULTIVATING PEYOTE' 'REFUSAL TO IDENTIFY'\n"
 " 'SHOOTING BY JUVENILE SUSPECT' 'DESTROYING JAIL PROPERTY-$200 OR UNDER'\n"
 " 'EMBEZZLEMENT, GRAND THEFT PUBLIC/PRIVATE OFFICIAL'], #879")

In [9]:
for desc in descriptions:
    if 'MURD' in desc or 'HOM' in desc or 'PROST' in desc or 'RAPE' in desc:
        print(desc)


ENGAGING IN LEWD CONDUCT - PROSTITUTION RELATED
ATTEMPTED HOMICIDE WITH A GUN
ASSAULT TO RAPE WITH BODILY FORCE
ATTEMPTED HOMICIDE WITH BODILY FORCE
FORCIBLE RAPE, BODILY FORCE
ATTEMPTED HOMICIDE WITH A KNIFE
SOLICITS FOR ACT OF PROSTITUTION
LOITERING FOR PURPOSE OF PROSTITUTION
ATTEMPTED HOMICIDE WITH A DANGEROUS WEAPON
RAPE, SPOUSAL
ATTEMPTED RAPE, BODILY FORCE
GRAND THEFT BY PROSTITUTE
FORCIBLE RAPE, ARMED WITH A SHARP INSTRUMENT
FORCIBLE RAPE, ARMED WITH A GUN
INDECENT EXPOSURE - PROSTITUTION RELATED
INMATE/KEEPER OF HOUSE OF PROSTITUTION
FORCIBLE RAPE, ARMED WITH A DANGEROUS WEAPON
ASSAULT TO RAPE WITH A GUN
ATTEMPTED RAPE WITH A GUN
ASSAULT OR ATTEMPTED MURDER UPON GOV'T OFFICERS
VEHICLE, RECOVERED, CAMPER-HOUSE CAR-MOTOR HOME
ASSAULT TO RAPE WITH A DANGEROUS WEAPON
SOLICITS TO VISIT HOUSE OF PROSTITUTION
ATTEMPTED RAPE, ARMED WITH A SHARP INSTRUMENT
ATTEMPTED RAPE, ARMED WITH A DANGEROUS WEAPON
VEHICLE, RECOVERED, MOBILE HOME-TRAILER
ASSAULT TO RAPE WITH A SHARP INSTRUMENT
PLACING WIFE IN HOUSE OF PROSTITUTION
ATTEMPTED HOMICIDE WITH EXPLOSIVES
PURCHASE FEMALE FOR THE PURPOSE OF PROSTITUTION

In [10]:
adresses = data['Address'].unique()
pprint.pprint("Adresses: {} #{}".format(adresses, len(adresses)), indent=2)


("Adresses: ['OAK ST / LAGUNA ST' 'VANNESS AV / GREENWICH ST'\n"
 " '1500 Block of LOMBARD ST' ..., '300 Block of JOHN F KENNEDY DR'\n"
 " 'FOLSOM ST / ZENO PL' '1000 Block of 22ND AV'] #23228")

In [11]:
data['Category'].value_counts()


Out[11]:
LARCENY/THEFT                  174900
OTHER OFFENSES                 126182
NON-CRIMINAL                    92304
ASSAULT                         76876
DRUG/NARCOTIC                   53971
VEHICLE THEFT                   53781
VANDALISM                       44725
WARRANTS                        42214
BURGLARY                        36755
SUSPICIOUS OCC                  31414
MISSING PERSON                  25989
ROBBERY                         23000
FRAUD                           16679
FORGERY/COUNTERFEITING          10609
SECONDARY CODES                  9985
WEAPON LAWS                      8555
PROSTITUTION                     7484
TRESPASS                         7326
STOLEN PROPERTY                  4540
SEX OFFENSES FORCIBLE            4388
DISORDERLY CONDUCT               4320
DRUNKENNESS                      4280
RECOVERED VEHICLE                3138
KIDNAPPING                       2341
DRIVING UNDER THE INFLUENCE      2268
RUNAWAY                          1946
LIQUOR LAWS                      1903
ARSON                            1513
LOITERING                        1225
EMBEZZLEMENT                     1166
SUICIDE                           508
FAMILY OFFENSES                   491
BAD CHECKS                        406
BRIBERY                           289
EXTORTION                         256
SEX OFFENSES NON FORCIBLE         148
GAMBLING                          146
PORNOGRAPHY/OBSCENE MAT            22
TREA                                6
Name: Category, dtype: int64

In [12]:
# load google api key
file = open("./assets/gapi.key", 'r')
key = file.read()
file.close()
gmaps.configure(api_key=key)

In [13]:
# Creating a location subset from the most current crimes (2015)
import datetime
start_date = datetime.date(2015,1,1)
end_date = datetime.date(2016,1,1)
date_mask = (data['Dates'] > start_date) & (data['Dates'] <= end_date)
location_subset = data.loc[date_mask][['Y', 'X']]
locations = [tuple(x) for x in location_subset.values]
len(locations)


Out[13]:
27584

In [14]:
fig = gmaps.figure()

In [15]:
fig.add_layer(gmaps.heatmap_layer(locations))

In [16]:
fig



In [17]:
samp = pd.read_csv('../../data/raw/henrik/sampleSubmission.csv')

In [18]:
samp.head()


Out[18]:
Id ARSON ASSAULT BAD CHECKS BRIBERY BURGLARY DISORDERLY CONDUCT DRIVING UNDER THE INFLUENCE DRUG/NARCOTIC DRUNKENNESS ... SEX OFFENSES NON FORCIBLE STOLEN PROPERTY SUICIDE SUSPICIOUS OCC TREA TRESPASS VANDALISM VEHICLE THEFT WARRANTS WEAPON LAWS
0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 1 0
1 1 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 1 0
2 2 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 1 0
3 3 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 1 0
4 4 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 1 0

5 rows × 40 columns


In [19]:
data.head()


Out[19]:
Dates Category Descript DayOfWeek PdDistrict Resolution Address X Y
0 2015-05-13 23:53:00 WARRANTS WARRANT ARREST Wednesday NORTHERN ARREST, BOOKED OAK ST / LAGUNA ST -122.425892 37.774599
1 2015-05-13 23:53:00 OTHER OFFENSES TRAFFIC VIOLATION ARREST Wednesday NORTHERN ARREST, BOOKED OAK ST / LAGUNA ST -122.425892 37.774599
2 2015-05-13 23:33:00 OTHER OFFENSES TRAFFIC VIOLATION ARREST Wednesday NORTHERN ARREST, BOOKED VANNESS AV / GREENWICH ST -122.424363 37.800414
3 2015-05-13 23:30:00 LARCENY/THEFT GRAND THEFT FROM LOCKED AUTO Wednesday NORTHERN NONE 1500 Block of LOMBARD ST -122.426995 37.800873
4 2015-05-13 23:30:00 LARCENY/THEFT GRAND THEFT FROM LOCKED AUTO Wednesday PARK NONE 100 Block of BRODERICK ST -122.438738 37.771541

In [ ]:


In [20]:
# Manual Inspection of specific incident
specific_incidents = data.loc[data['Category']=='KIDNAPPING']

In [21]:
start_date = datetime.date(2010,1,1)
end_date = datetime.date(2016,1,1)
date_mask = (specific_incidents['Dates'] > start_date) & (specific_incidents['Dates'] <= end_date)
location_subset = specific_incidents.loc[date_mask][['Y', 'X']]
locations = [tuple(x) for x in location_subset.values]
len(locations)


Out[21]:
1167

In [22]:
spec_fig2015 = gmaps.figure()
spec_fig2015.add_layer(gmaps.heatmap_layer(locations))
spec_fig2015



In [24]:
data['Dates'].astype('int64').quantile([1/6,2/6,3/6,4/6,5/6]).astype('datetime64[ns]')


Out[24]:
0.166667   2004-12-23 17:00:00
0.333333   2007-01-27 20:00:00
0.500000   2009-03-07 16:00:00
0.666667   2011-05-08 10:37:00
0.833333   2013-06-02 21:50:00
Name: Dates, dtype: datetime64[ns]

In [58]:
import datetime
# divide days into 6 parts
# 0: 00:01 - 04:00 AM
# 1: 04:01 - 08:00 AM
# 2: 08:01 - 12:00 AM
# 3: 12:01 - 16:00 PM
# 4: 16:01 - 20:00 PM
# 5: 20:01 - 00:00 PM
first_sixth = datetime.time(23,59,59)
second_sixth = datetime.time(3,59,59)
third_sixth = datetime.time(7,59,59)
fourth_sixth = datetime.time(11,59,59)
fifth_sixth = datetime.time(15,59,59)
sixth_sixth = datetime.time(19,59,59)
print(first_sixth)
print(second_sixth)
print(third_sixth)
print(fourth_sixth)
print(fifth_sixth)
print(sixth_sixth)

def sixths_days(date_time):
    """
    Mapping time to sixths of a day
    """
    if date_time.time() > datetime.time(0,0,0) and date_time.time() <= second_sixth:
        return 0
    if date_time.time() > second_sixth and date_time.time() <= third_sixth:
        return 1
    if date_time.time() > third_sixth and date_time.time() <= fourth_sixth:
        return 2
    if date_time.time() > fourth_sixth and date_time.time() <= fifth_sixth:
        return 3
    if date_time.time() > fifth_sixth and date_time.time() <= sixth_sixth:
        return 4
    if date_time.time() > sixth_sixth and date_time.time() <= first_sixth:
        return 5


23:59:59
03:59:59
07:59:59
11:59:59
15:59:59
19:59:59

In [60]:
data['Sixths'] = data['Dates'].map(sixths_days)

In [61]:
data.head()


Out[61]:
Dates Category Descript DayOfWeek PdDistrict Resolution Address X Y Sixths
0 2015-05-13 23:53:00 WARRANTS WARRANT ARREST Wednesday NORTHERN ARREST, BOOKED OAK ST / LAGUNA ST -122.425892 37.774599 5
1 2015-05-13 23:53:00 OTHER OFFENSES TRAFFIC VIOLATION ARREST Wednesday NORTHERN ARREST, BOOKED OAK ST / LAGUNA ST -122.425892 37.774599 5
2 2015-05-13 23:33:00 OTHER OFFENSES TRAFFIC VIOLATION ARREST Wednesday NORTHERN ARREST, BOOKED VANNESS AV / GREENWICH ST -122.424363 37.800414 5
3 2015-05-13 23:30:00 LARCENY/THEFT GRAND THEFT FROM LOCKED AUTO Wednesday NORTHERN NONE 1500 Block of LOMBARD ST -122.426995 37.800873 5
4 2015-05-13 23:30:00 LARCENY/THEFT GRAND THEFT FROM LOCKED AUTO Wednesday PARK NONE 100 Block of BRODERICK ST -122.438738 37.771541 5

In [62]:
data.tail()


Out[62]:
Dates Category Descript DayOfWeek PdDistrict Resolution Address X Y Sixths
878044 2003-01-06 00:15:00 ROBBERY ROBBERY ON THE STREET WITH A GUN Monday TARAVAL NONE FARALLONES ST / CAPITOL AV -122.459033 37.714056 0
878045 2003-01-06 00:01:00 LARCENY/THEFT GRAND THEFT FROM LOCKED AUTO Monday INGLESIDE NONE 600 Block of EDNA ST -122.447364 37.731948 0
878046 2003-01-06 00:01:00 LARCENY/THEFT GRAND THEFT FROM LOCKED AUTO Monday SOUTHERN NONE 5TH ST / FOLSOM ST -122.403390 37.780266 0
878047 2003-01-06 00:01:00 VANDALISM MALICIOUS MISCHIEF, VANDALISM OF VEHICLES Monday SOUTHERN NONE TOWNSEND ST / 2ND ST -122.390531 37.780607 0
878048 2003-01-06 00:01:00 FORGERY/COUNTERFEITING CHECKS, FORGERY (FELONY) Monday BAYVIEW NONE 1800 Block of NEWCOMB AV -122.394926 37.738212 0

In [63]:
data['Sixths'].value_counts()


Out[63]:
4    208269
3    187561
5    176556
2    144634
0    107348
1     53681
Name: Sixths, dtype: int64

In [ ]: