<jupyter_start><jupyter_text>Importing Pandas for data reading and data manipulation import pandas as pd  Reading data<jupyter_code>data = pd.read_csv("C:\\Users\\ambar\\Downloads\\3. Police Data.csv")<jupyter_output><empty_output><jupyter_text>Reading first few rows and columns<jupyter_code>data.head()<jupyter_output><empty_output><jupyter_text>Total no of rows and features<jupyter_code>data.shape<jupyter_output><empty_output><jupyter_text>Data type of each variable<jupyter_code>data.dtypes<jupyter_output><empty_output><jupyter_text>Some basic information of data<jupyter_code>data.info()<jupyter_output><class 'pandas.core.frame.DataFrame'>
RangeIndex: 65535 entries, 0 to 65534
Data columns (total 15 columns):
 #   Column              Non-Null Count  Dtype  
---  ------              --------------  -----  
 0   stop_date           65535 non-null  object 
 1   stop_time           65535 non-null  object 
 2   country_name        0 non-null      float64
 3   driver_gender       61474 non-null  object 
 4   driver_age_raw      61481 non-null  float64
 5   driver_age          61228 non-null  float64
 6   driver_race         61475 non-null  object 
 7   violation_raw       61475 non-null  object 
 8   violation           61475 non-null  object 
 9   search_conducted    65535 non-null  bool   
 10  search_type         2479 non-null   object 
 11  stop_outcome        61475 non-null  object 
 12  is_arrested         61475 non-null  object 
 13  stop_duration       61475 non-null  object 
 14  drugs_related_stop  65535 non-null  bool   
dtypes: bool(2), float64(3), object(10)
memory usage: 6.6+[...]<jupyter_text>Q. Is there any null values present or not ?<jupyter_code>data.isnull().any()<jupyter_output><empty_output><jupyter_text>Total count of null values of each features<jupyter_code>data.isnull().sum()<jupyter_output><empty_output><jupyter_text>Columns names<jupyter_code>data.columns<jupyter_output><empty_output><jupyter_text>Dropping the column country_name as all values are null Use of inplace to make sure it is permanently dropped<jupyter_code>data.drop(columns = 'country_name' , inplace = True)<jupyter_output><empty_output><jupyter_text>Checking if that column is dropped or not ?<jupyter_code>data.head()<jupyter_output><empty_output><jupyter_text>Checking Gender wise Speeding Violation<jupyter_code>data[data.violation == 'Speeding'].driver_gender.value_counts()<jupyter_output><empty_output><jupyter_text>import matplotlib.pyplot as plt<jupyter_code>data[data.violation == 'Speeding'].driver_gender.value_counts().\
plot(kind = 'bar' , xlabel = 'Gender' , ylabel = 'Count' , title = 'Gender wise Traffic Rules violation'  )<jupyter_output><empty_output><jupyter_text>Gender wise Search Conducted by Police<jupyter_code>data.groupby('driver_gender').search_conducted.sum()\
.plot(title = 'Gender wise search conducted by police', kind = 'bar' , xlabel = 'Gender' , ylabel = 'Count')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10166045408336158, 'fraction_numerical': 0.039986445272788884, 'mean_word_length': 4.377049180327869, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 53, 'https://': 0, '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': '13', 'dir': 'jupyter-structured-clean-dedup', 'id': '665501', 'license': 'Apache-2.0', 'n_tokens_mistral': 1083, 'n_tokens_neox': 981, 'n_words': 219, 'path': 'Police_Data.ipynb', 'repo_name': 'amber5634/Analyzing-the-Police-data', 'size': '2951'}