Background
The Executive Director of the San Francisco Police Department (SFPD) Strategic Management Bureau, Catherine McGuire, is overseeing change management efforts within the SFPD. She is auditing the patrolling assigned to each neighborhood throughout different times of the day, as well as the case closing rates of the police precincts. Catherine has the following questions: What five neighborhoods had the lowest crime count? Which three police precincts had the highest case closing rate? At what hour of the day was crime count the highest in each neighborhood?

Data
The data source for this analysis was the SF Open Data website. The data set includes police incident reports filed by officers and individuals through self-service online reporting for non-emergency cases. The reports included are those for incidents that occurred from January 1, 2018 through December 31, 2018, with 145,715 observations in total.

Originally, the data set also contained 7,906 missing observations, but we decided to drop those; these observations only comprised about five percent of the total observations in our data set. We verified that these missing observations had no common motive for being absent from our data set before dropping them. Next, it was necessary to filter and group the data because we only needed information from certain rows and columns for our analysis. Then, to address which five neighborhoods had the lowest crime count and the time at which crime count was the highest in each neighborhood, we initially wanted to calculate the rate, but ended up calculating the count instead. We chose to calculate the count because our data set did not include population data relative to each district, and calculating counts was still valuable, especially since people relocate within the city all the time. To determine which three police precincts had the highest closing rate, we had to label each report individually based on whether it was closed or not closed to calculate the closing rates. We also had to merge together all the crime rates that were computed at the individual neighborhood-level to get the results concisely in one table. Lastly, all aggregation was done through our program. 









Results
1) The five neighborhoods with the lowest crime count are McLaren Park, Lincoln Park, Seacliff, Presidio, and Treasure Island.














2) The three police precincts with the highest case closing rates are Tenderloin, South of Market, and Mission.



















  3) Each neighborhood had its own peak crime time.

##    Incident Time Count                   Neighborhood
## 1        0:00:00   354                South of Market
## 2       14:00:00     8                       Seacliff
## 3       11:25:00    10                   McLaren Park
## 4       16:00:00    11                       Presidio
## 5        0:00:00    58              Visitacion Valley
## 6       15:00:00    17                Treasure Island
## 7       14:00:00    13                   Lincoln Park
## 8        0:00:00    29               Presidio Heights
## 9       20:00:00    52                      Japantown
## 10       0:00:00    56     Oceanview/Merced/Ingleside
## 11       0:00:00    64                      Excelsior
## 12       0:00:00    57                     Noe Valley
## 13      12:00:00    29                     Twin Peaks
## 14       0:00:00   146            Castro/Upper Market
## 15      18:00:00    23                      Glen Park
## 16      19:00:00   118               Western Addition
## 17      20:00:00   102                      Chinatown
## 18       0:00:00    98                Pacific Heights
## 19      12:00:00   115                   Russian Hill
## 20      18:00:00   108                   Hayes Valley
## 21       0:00:00   174                       Nob Hill
## 22      12:00:00   189                Sunset/Parkside
## 23      12:00:00   103             West of Twin Peaks
## 24      22:00:00    41                        Portola
## 25      12:00:00   169                    North Beach
## 26      12:00:00    93                         Marina
## 27       0:00:00    96                   Potrero Hill
## 28      12:00:00    64                     Tenderloin
## 29       0:00:00   360                           SOMA
## 30      12:00:00    48                      Lakeshore
## 31       0:00:00    60                 Inner Richmond
## 32      12:00:00    73                 Haight Ashbury
## 33       0:00:00   237          Bayview Hunters Point
## 34       0:00:00   143                    Mission Bay
## 35       0:00:00    67                 Bernal Heights
## 36       0:00:00   102                 Outer Richmond
## 37       0:00:00   395                        Mission
## 38       0:00:00    56              Lone Mountain/USF
## 39      15:00:00    69               Golden Gate Park
## 40      12:00:00   354 Financial District/South Beach
## 41       0:00:00    59                  Outer Mission



Recommendations
Based on our findings, I suggest Catherine allocate police patrolling accordingly. She should shift the amount of patrolling gradually to see the effects it has on each neighborhood, especially considering the fact that the amount of crime in certain neighborhoods may be low because of the amount of patrolling in place. Catherine should also increase the amount of patrolling at peak times in respective neighborhoods in the same manner. Lastly, I would suggest offering incentives, such as cash bonuses, to precincts with low case closing rates to motivate a higher rate.