Crime Rate Against Women Ver 2.0

Data from 'Data.gov.in'

File names:

>>crcCAW.CSV : `Number of Crime against women`
>>pacCAW.CSV : 'Number of Person Involved in Crime against Women'


Here In this Notebook we will separate all crimes against women according to category and remove all the rows about Total Crimes. and separate all the crimes in individual dataframe.. Hope we'll succed


In [2]:
#Lets now import necessary libraries which will help us
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

In [3]:
crimes = pd.read_csv('crcCAW.csv')

In [5]:
crimes.head() #lets give it a look


Out[5]:
STATE/UT CRIME HEAD 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012
0 ANDHRA PRADESH RAPE 871 1002 946 1016 935 1049 1070 1257 1188 1362 1442 1341
1 ARUNACHAL PRADESH RAPE 33 38 31 42 35 37 48 42 59 47 42 46
2 ASSAM RAPE 817 970 1095 1171 1238 1244 1437 1438 1631 1721 1700 1716
3 BIHAR RAPE 888 1040 985 1390 1147 1232 1555 1302 929 795 934 927
4 CHHATTISGARH RAPE 959 992 898 969 990 995 982 978 976 1012 1053 1034

In [16]:
pd.unique(crimes['CRIME HEAD']) # we got all crimes releated to women in the datframe now we can extract the crimes 
#pd.unique(df.values.ravel())


Out[16]:
array(['RAPE', 'KIDNAPPING and ABDUCTION', 'DOWRY DEATHS',
       'ASSAULT ON WOMEN WITH INTENT TO OUTRAGE HER MODESTY',
       'INSULT TO THE MODESTY OF WOMEN',
       'CRUELTY BY HUSBAND OR HIS RELATIVES (IPC SECTION 498A)',
       'IMPORTATION OF GIRLS FROM FOREIGN COUNTRY',
       'IMMORAL TRAFFIC (P) ACT', 'DOWRY PROHIBITION ACT',
       'INDECENT REPRESENTATION OF WOMEN (P) ACT',
       'COMMISSION OF SATI PREVENTION ACT', 'TOTAL CRIMES AGAINST WOMEN'], dtype=object)

lets extract all rapes releated crime first

as we did it in previous version

First we will remove all the entries releated to Total of the crimes as we don't want total now


In [28]:
#df = df[df.line_race != 0] this is we are going to do to remove the total entries
crimes_ver1 = crimes[crimes['CRIME HEAD']!='TOTAL CRIMES AGAINST WOMEN']

In [29]:
crimes_ver2 =  crimes_ver1[crimes_ver1['STATE/UT']!='TOTAL (ALL-INDIA)']

In [31]:
crimes_ver3 = crimes_ver2[crimes_ver2['STATE/UT']!='TOTAL (STATES)']

In [34]:
crimes_ver4 =  crimes_ver3[crimes_ver3['STATE/UT']!='TOTAL (UTs)']

In [36]:
crimes_ver4.to_csv('crimescleaned.csv')

Now we have a cleaned data with no data named Total crimes and total states and total(all india) or total(all ut)


In [46]:
name = 'kartik'
import os
DIR_PATH = os.path.abspath
DIR_

In [49]:
os.walk(',')


Out[49]:
<generator object walk at 0x02C6AFD0>

In [ ]: