Download data for any state: https://openpolicing.stanford.edu/
Preparing the data
We need to know how’s our data look like and clean up the data before we start to analyse any data.
Also we need to check the data type of each column.

Difference between isna() and isnull() in pandas
Thanks for contributing an answer to Data Science Stack Exchange! Please be sure to answer the question. Provide…
datascience.stackexchange.com
isnull is same as isna.



Creating a Datetime Index
str.cat is a method to concatenate two column into one, in this case combine the data and time
https://pandas.pydata.org/docs/reference/api/pandas.Series.str.cat.html



Start analyse
- Do the genders commit different violations?


2.Does gender affect who gets a ticket for speeding?



3.Does gender affect whose vehicle is searched?


4.Does time of day affect arrest rate?


5.Are drug-related stops on the rise?
If you trying to get the statistic value from a period of time, resample can help.
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.resample.html








所有评论(0)