Grade = 8/10
In [65]:
import pandas as pd
%matplotlib inline
In [66]:
df_codes = pd.read_csv("DOF_Parking_Violation_Codes.csv")
In [67]:
df_codes.head()
Out[67]:
CODE
DEFINITION
Manhattan 96th St. & below
All Other Areas
0
10
Stopping, standing or parking where a sign, st...
$115
$115
1
11
Hotel Loading/Unloading: Standing or parking w...
$115
$115
2
12
Snow Emergency: Standing or parking where stan...
$95
$95
3
13
Taxi Stand: Standing or parking where standing...
$115
$115
4
14
General No Standing: Standing or parking where...
$115
$115
In [68]:
df = pd.read_csv("violations.csv", nrows=100000, low_memory=False, parse_dates=True)
In [69]:
df.head()
Out[69]:
Summons Number
Plate ID
Registration State
Plate Type
Issue Date
Violation Code
Vehicle Body Type
Vehicle Make
Issuing Agency
Street Code1
...
Vehicle Color
Unregistered Vehicle?
Vehicle Year
Meter Number
Feet From Curb
Violation Post Code
Violation Description
No Standing or Stopping Violation
Hydrant Violation
Double Parking Violation
0
1283294138
GBB9093
NY
PAS
08/04/2013
46
SUBN
AUDI
P
37250
...
GY
0.0
2013
-
0
NaN
NaN
NaN
NaN
NaN
1
1283294151
62416MB
NY
COM
08/04/2013
46
VAN
FORD
P
37290
...
WH
0.0
2012
-
0
NaN
NaN
NaN
NaN
NaN
2
1283294163
78755JZ
NY
COM
08/05/2013
46
P-U
CHEVR
P
37030
...
NaN
0.0
0
-
0
NaN
NaN
NaN
NaN
NaN
3
1283294175
63009MA
NY
COM
08/05/2013
46
VAN
FORD
P
37270
...
WH
0.0
2010
-
0
NaN
NaN
NaN
NaN
NaN
4
1283294187
91648MC
NY
COM
08/08/2013
41
TRLR
GMC
P
37240
...
BR
0.0
2012
-
0
NaN
NaN
NaN
NaN
NaN
5 rows × 43 columns
In [ ]:
In [70]:
df.columns
Out[70]:
Index(['Summons Number', 'Plate ID', 'Registration State', 'Plate Type',
'Issue Date', 'Violation Code', 'Vehicle Body Type', 'Vehicle Make',
'Issuing Agency', 'Street Code1', 'Street Code2', 'Street Code3',
'Vehicle Expiration Date', 'Violation Location', 'Violation Precinct',
'Issuer Precinct', 'Issuer Code', 'Issuer Command', 'Issuer Squad',
'Violation Time', 'Time First Observed', 'Violation County',
'Violation In Front Of Or Opposite', 'House Number', 'Street Name',
'Intersecting Street', 'Date First Observed', 'Law Section',
'Sub Division', 'Violation Legal Code', 'Days Parking In Effect ',
'From Hours In Effect', 'To Hours In Effect', 'Vehicle Color',
'Unregistered Vehicle?', 'Vehicle Year', 'Meter Number',
'Feet From Curb', 'Violation Post Code', 'Violation Description',
'No Standing or Stopping Violation', 'Hydrant Violation',
'Double Parking Violation'],
dtype='object')
In [71]:
# I want to make sure my Plate ID is a string. Can't lose the leading zeroes!
df['Plate ID'] = df['Plate ID'].astype(str)
In [72]:
type(df['Plate ID'][0])
#Yay
Out[72]:
str
In [73]:
#I don't think anyone's car was built in 0AD. Discard the '0's as NaN.
#df['Vehicle Year'].head() --> OK there are some 0s
df['Vehicle Year'] = df['Vehicle Year'].replace('0','NaN')
In [74]:
df['Vehicle Year'].head()
#YAY
Out[74]:
0 2013
1 2012
2 NaN
3 2010
4 2012
Name: Vehicle Year, dtype: object
In [75]:
#I want the dates to be dates! Read the read_csv documentation to find out how to make pandas
#automatically parse dates.
#Added parse_dates=True to the dataframe
In [76]:
df['Date First Observed'] = df['Date First Observed'].astype(str)
In [77]:
#"Date first observed" is a pretty weird column, but it seems like it has a date hiding inside.
#Using a function with .apply, transform the string (e.g. "20140324") into a Python date. Make the 0's show up as NaN.
def date_observed_python(date_observed):
if date_observed == '0':
return ('NaN')
else:
return date_observed[:4] + '-' + date_observed[4:6] + '-' + date_observed[6:8]
#df['Date First Observed'] = pd.to_datetime(df['Date First Observed'].astype(str), format='%Y%m%d')
In [78]:
df['Date First Observed'] = df['Date First Observed'].apply(date_observed_python)
In [79]:
df['Date First Observed'].head(200)
Out[79]:
0 NaN
1 NaN
2 NaN
3 NaN
4 NaN
5 NaN
6 NaN
7 NaN
8 NaN
9 NaN
10 NaN
11 NaN
12 NaN
13 NaN
14 NaN
15 NaN
16 NaN
17 NaN
18 NaN
19 NaN
20 NaN
21 NaN
22 NaN
23 NaN
24 NaN
25 NaN
26 NaN
27 NaN
28 NaN
29 NaN
...
170 NaN
171 NaN
172 NaN
173 NaN
174 NaN
175 NaN
176 2013-07-26
177 NaN
178 NaN
179 NaN
180 NaN
181 NaN
182 NaN
183 NaN
184 NaN
185 NaN
186 NaN
187 NaN
188 NaN
189 NaN
190 NaN
191 NaN
192 NaN
193 NaN
194 NaN
195 NaN
196 NaN
197 NaN
198 NaN
199 NaN
Name: Date First Observed, dtype: object
In [80]:
#"Violation time" is... not a time. Make it a time.
df['Violation Time'].head()
Out[80]:
0 0752A
1 1240P
2 1243P
3 0232P
4 1239P
Name: Violation Time, dtype: object
In [81]:
import datetime
import numpy as np
def violation_time(str_violation_time):
try:
if str_violation_time == 'TrueM':
return np.nan
with_pm = str_violation_time + 'M'
return datetime.datetime.strptime(with_pm,"%I%M%p")
except:
return np.nan
print(violation_time('0752A'))
1900-01-01 07:52:00
In [82]:
df['converted_violation_time'] = df['Violation Time'].apply(violation_time)
In [83]:
df['converted_violation_time'].head()
Out[83]:
0 1900-01-01 07:52:00
1 1900-01-01 12:40:00
2 1900-01-01 12:43:00
3 1900-01-01 14:32:00
4 1900-01-01 12:39:00
Name: converted_violation_time, dtype: datetime64[ns]
In [84]:
import datetime
df['Issue Date'].head().astype(datetime.datetime)
Out[84]:
0 08/04/2013
1 08/04/2013
2 08/05/2013
3 08/05/2013
4 08/08/2013
Name: Issue Date, dtype: object
In [85]:
#There sure are a lot of colors of cars, too bad so many of them are the same.
#Make "BLK" and "BLACK", "WT" and "WHITE", and any other combinations that you notice.
df['Vehicle Color'].head()
Out[85]:
0 GY
1 WH
2 NaN
3 WH
4 BR
Name: Vehicle Color, dtype: object
In [86]:
df['Vehicle Color'] = df['Vehicle Color'].astype(str)
In [87]:
def vehicle_color_str(vehicle_color):
return str(vehicle_color.replace('WH','WHITE').replace('GY','GREY').replace('RD','RED').replace('YELL','YELLOW').replace('BR','BROWN').replace('BK','BLACK').replace('BL','BLUE'))
In [88]:
df['Vehicle Color'] = df['Vehicle Color'].apply(vehicle_color_str)
In [89]:
df['Vehicle Color'].head()
Out[89]:
0 GREY
1 WHITE
2 nan
3 WHITE
4 BROWN
Name: Vehicle Color, dtype: object
In [90]:
#Join the data with the Parking Violations Code dataset from
#the NYC Open Data site.
df['Violation Code'] = df['Violation Code'].astype(str)
In [91]:
new_df = df.merge(df_codes, left_on='Violation Code', right_on='CODE', how='left')
new_df
Out[91]:
Summons Number
Plate ID
Registration State
Plate Type
Issue Date
Violation Code
Vehicle Body Type
Vehicle Make
Issuing Agency
Street Code1
...
Violation Post Code
Violation Description
No Standing or Stopping Violation
Hydrant Violation
Double Parking Violation
converted_violation_time
CODE
DEFINITION
Manhattan 96th St. & below
All Other Areas
0
1283294138
GBB9093
NY
PAS
08/04/2013
46
SUBN
AUDI
P
37250
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 07:52:00
46
Standing or parking on the roadway side of a v...
$115
$115
1
1283294151
62416MB
NY
COM
08/04/2013
46
VAN
FORD
P
37290
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 12:40:00
46
Standing or parking on the roadway side of a v...
$115
$115
2
1283294163
78755JZ
NY
COM
08/05/2013
46
P-U
CHEVR
P
37030
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 12:43:00
46
Standing or parking on the roadway side of a v...
$115
$115
3
1283294175
63009MA
NY
COM
08/05/2013
46
VAN
FORD
P
37270
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 14:32:00
46
Standing or parking on the roadway side of a v...
$115
$115
4
1283294187
91648MC
NY
COM
08/08/2013
41
TRLR
GMC
P
37240
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 12:39:00
NaN
NaN
NaN
NaN
5
1283294217
T60DAR
NJ
PAS
08/11/2013
14
P-U
DODGE
P
37250
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 18:17:00
14
General No Standing: Standing or parking where...
$115
$115
6
1283294229
GCR2838
NY
PAS
08/11/2013
14
VAN
NaN
P
37250
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 19:41:00
14
General No Standing: Standing or parking where...
$115
$115
7
1283983620
XZ764G
NJ
PAS
08/07/2013
24
DELV
FORD
X
63430
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 04:25:00
24
Authorized Vehicles Only: No parking where par...
$65
$60
8
1283983631
GBH9379
NY
PAS
08/07/2013
24
SDN
TOYOT
X
63430
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 04:37:00
24
Authorized Vehicles Only: No parking where par...
$65
$60
9
1283983667
MCL78B
NJ
PAS
07/18/2013
24
SDN
SUBAR
H
0
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 08:39:00
24
Authorized Vehicles Only: No parking where par...
$65
$60
10
1283983679
M367CN
NY
PAS
07/18/2013
24
SDN
HYUND
H
0
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 08:45:00
24
Authorized Vehicles Only: No parking where par...
$65
$60
11
1283983734
GAR6813
NY
PAS
07/18/2013
24
SDN
TOYOT
H
0
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 09:07:00
24
Authorized Vehicles Only: No parking where par...
$65
$60
12
1283983771
GEN8674
NY
PAS
07/31/2013
24
SDN
AUDI
X
0
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 17:14:00
24
Authorized Vehicles Only: No parking where par...
$65
$60
13
1283983825
GAC2703
NY
PAS
08/12/2013
24
SDN
NISSA
X
23230
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 18:56:00
24
Authorized Vehicles Only: No parking where par...
$65
$60
14
1286036800
40793JY
NY
COM
07/05/2013
14
VAN
CHEVR
P
34190
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 23:45:00
14
General No Standing: Standing or parking where...
$115
$115
15
1286123550
GAD1485
NY
PAS
08/12/2013
20
SDN
VOLKS
T
28930
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 17:46:00
20
General No Parking: No parking where parking i...
$65
$60
16
1286246398
GFC5338
NY
PAS
07/26/2013
14
SDN
TOYOT
T
0
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 11:42:00
14
General No Standing: Standing or parking where...
$115
$115
17
1286246416
815M342
MD
PAS
07/30/2013
20
SUBN
SATUR
T
0
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 07:24:00
20
General No Parking: No parking where parking i...
$65
$60
18
1286248000
GJA3452
NY
PAS
07/23/2013
14
SDN
KIA
T
73690
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 07:58:00
14
General No Standing: Standing or parking where...
$115
$115
19
1286282330
YZY6476
NC
PAS
07/29/2013
20
SDN
NISSA
T
32030
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 07:36:00
20
General No Parking: No parking where parking i...
$65
$60
20
1286282342
WBJ819
LA
PAS
08/07/2013
17
SUBN
HONDA
T
0
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 08:47:00
17
Authorized Vehicles Only: Standing or parking ...
$95
$95
21
1286289841
GAV9235
NY
PAS
07/20/2013
50
SDN
HONDA
T
0
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 11:20:00
50
Stopping, standing or parking in a crosswalk. ...
$115
$115
22
1286654920
ZTR66R
NJ
PAS
07/18/2013
50
SDN
N/S
T
0
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 10:20:00
50
Stopping, standing or parking in a crosswalk. ...
$115
$115
23
1286799648
GDE3973
NY
PAS
07/20/2013
40
SDN
TOYOT
T
0
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 15:24:00
40
Stopping, standing or parking closer than 15 f...
$115
$115
24
1286807062
P193871
IL
PAS
08/10/2013
40
SDN
SCIO
T
26630
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 10:18:00
40
Stopping, standing or parking closer than 15 f...
$115
$115
25
1286807475
GGL6608
NY
PAS
07/26/2013
40
SDN
NISSA
T
73650
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 07:43:00
40
Stopping, standing or parking closer than 15 f...
$115
$115
26
1286807633
84301JU
NY
COM
07/19/2013
14
P-U
DODGE
X
63030
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 08:50:00
14
General No Standing: Standing or parking where...
$115
$115
27
1286808807
HHG3545
PA
PAS
08/06/2013
20
SDN
TOYOT
T
21130
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 09:15:00
20
General No Parking: No parking where parking i...
$65
$60
28
1287320491
50097JX
NY
COM
08/07/2013
40
VAN
MERCU
T
23190
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 10:23:00
40
Stopping, standing or parking closer than 15 f...
$115
$115
29
1287320570
GEJ9154
NY
PAS
08/06/2013
51
VAN
TOYOT
X
93230
...
NaN
NaN
NaN
NaN
NaN
1900-01-01 11:20:00
51
Stopping, standing or parking on a sidewalk.
$115
$115
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
99970
7021661666
GCN6488
NY
PAS
08/26/2013
21
SUBN
DODGE
T
50290
...
F -
21-No Parking (street clean)
NaN
NaN
NaN
1900-01-01 08:06:00
21
Street Cleaning: No parking where parking is n...
$65
$45
99971
7021661678
PD861B
FL
PAS
08/26/2013
21
4DSD
HONDA
T
25240
...
F -
21-No Parking (street clean)
NaN
NaN
NaN
1900-01-01 08:10:00
21
Street Cleaning: No parking where parking is n...
$65
$45
99972
7021661708
GEM5459
NY
PAS
08/26/2013
21
4DSD
TOYOT
T
25240
...
F -
21-No Parking (street clean)
NaN
NaN
NaN
1900-01-01 08:15:00
21
Street Cleaning: No parking where parking is n...
$65
$45
99973
7021661733
GHL3207
NY
PAS
08/26/2013
21
2DSD
HONDA
T
24540
...
F -
21-No Parking (street clean)
NaN
NaN
NaN
1900-01-01 08:37:00
21
Street Cleaning: No parking where parking is n...
$65
$45
99974
7021661745
GGP4922
NY
PAS
08/26/2013
21
4DSD
TOYOT
T
24440
...
F -
21-No Parking (street clean)
NaN
NaN
NaN
1900-01-01 08:39:00
21
Street Cleaning: No parking where parking is n...
$65
$45
99975
7021661769
GED9571
NY
PAS
08/26/2013
21
4DSD
NISSA
T
24590
...
F -
21-No Parking (street clean)
NaN
NaN
NaN
1900-01-01 08:43:00
21
Street Cleaning: No parking where parking is n...
$65
$45
99976
7021661782
nan
NY
999
08/27/2013
74
4DSD
NISSA
T
49690
...
02 -
74-Missing Display Plate
NaN
NaN
NaN
1900-01-01 07:47:00
74
Standing or parking a vehicle without properly...
$65
$65
99977
7021661794
nan
NY
999
08/27/2013
51
4DSD
NISSA
T
49690
...
02 -
51-Sidewalk
NaN
NaN
NaN
1900-01-01 07:59:00
51
Stopping, standing or parking on a sidewalk.
$115
$115
99978
7021661800
nan
NY
999
08/27/2013
51
4DSD
NISSA
T
49690
...
02 -
51-Sidewalk
NaN
NaN
NaN
1900-01-01 08:17:00
51
Stopping, standing or parking on a sidewalk.
$115
$115
99979
7021661812
nan
NY
PAS
08/27/2013
74
4DSD
NISSA
T
49690
...
02 -
74-Missing Display Plate
NaN
NaN
NaN
1900-01-01 08:40:00
74
Standing or parking a vehicle without properly...
$65
$65
99980
7021661824
nan
NY
PAS
08/27/2013
51
4DSD
NISSA
T
49690
...
02 -
51-Sidewalk
NaN
NaN
NaN
1900-01-01 08:49:00
51
Stopping, standing or parking on a sidewalk.
$115
$115
99981
7021661848
T491409C
NY
OMT
08/27/2013
37
4DSD
LINCO
T
23290
...
02 -
37-Expired Muni Meter
NaN
NaN
NaN
1900-01-01 10:02:00
NaN
NaN
NaN
NaN
99982
7021661861
67733MC8
NY
COM
08/27/2013
38
R/RD
INTER
T
49690
...
02 -
38-Failure to Display Muni Rec
NaN
NaN
NaN
1900-01-01 10:14:00
NaN
NaN
NaN
NaN
99983
7021661873
R418032
IL
PAS
08/27/2013
37
SUBN
FORD
T
23040
...
02 -
37-Expired Muni Meter
NaN
NaN
NaN
1900-01-01 10:25:00
NaN
NaN
NaN
NaN
99984
7021661885
GHW1112
NY
PAS
08/27/2013
70
4DSD
NISSA
T
22940
...
02 -
70A-Reg. Sticker Expired (NYS)
NaN
NaN
NaN
1900-01-01 10:58:00
70
Standing or parking a vehicle without showing ...
$65
$65
99985
7021661897
nan
NY
PAS
08/27/2013
70
NaN
NaN
T
22940
...
02 -
70A-Reg. Sticker Expired (NYS)
NaN
NaN
NaN
1900-01-01 11:23:00
70
Standing or parking a vehicle without showing ...
$65
$65
99986
7021661915
nan
NY
PAS
08/27/2013
51
4DSD
NISSA
T
23490
...
02 -
51-Sidewalk
NaN
NaN
NaN
1900-01-01 11:34:00
51
Stopping, standing or parking on a sidewalk.
$115
$115
99987
7021661927
nan
NY
PAS
08/27/2013
74
4DSD
NISSA
T
23490
...
02 -
74-Missing Display Plate
NaN
NaN
NaN
1900-01-01 11:37:00
74
Standing or parking a vehicle without properly...
$65
$65
99988
7021661939
nan
NY
PAS
08/27/2013
51
4DSD
NISSA
T
23490
...
02 -
51-Sidewalk
NaN
NaN
NaN
1900-01-01 11:39:00
51
Stopping, standing or parking on a sidewalk.
$115
$115
99989
7021661940
nan
NY
PAS
08/27/2013
74
4DSD
NISSA
T
23490
...
02 -
74-Missing Display Plate
NaN
NaN
NaN
1900-01-01 11:41:00
74
Standing or parking a vehicle without properly...
$65
$65
99990
7021661952
nan
NY
PAS
08/27/2013
51
4DSD
NISSA
T
23490
...
02 -
51-Sidewalk
NaN
NaN
NaN
1900-01-01 11:44:00
51
Stopping, standing or parking on a sidewalk.
$115
$115
99991
7021661964
42103JM
NY
COM
08/27/2013
19
DELV
FRUEH
T
49690
...
02 -
19-No Stand (bus stop)
NaN
NaN
NaN
1900-01-01 11:51:00
19
Bus Stop: Standing or parking where standing i...
$115
$115
99992
7021661976
nan
NY
PAS
08/27/2013
74
4DSD
NISSA
T
24090
...
02 -
74-Missing Display Plate
NaN
NaN
NaN
1900-01-01 12:00:00
74
Standing or parking a vehicle without properly...
$65
$65
99993
7021661988
nan
NY
PAS
08/27/2013
51
4DSD
NISSA
T
24090
...
02 -
51-Sidewalk
NaN
NaN
NaN
1900-01-01 12:03:00
51
Stopping, standing or parking on a sidewalk.
$115
$115
99994
7021661990
nan
NY
PAS
08/27/2013
74
4DSD
HONDA
T
24090
...
02 -
74-Missing Display Plate
NaN
NaN
NaN
1900-01-01 12:06:00
74
Standing or parking a vehicle without properly...
$65
$65
99995
7021662002
nan
NY
PAS
08/27/2013
51
4DSD
HONDA
T
24090
...
02 -
51-Sidewalk
NaN
NaN
NaN
1900-01-01 12:08:00
51
Stopping, standing or parking on a sidewalk.
$115
$115
99996
7021662014
nan
NY
PAS
08/27/2013
74
4DSD
HONDA
T
24090
...
02 -
74-Missing Display Plate
NaN
NaN
NaN
1900-01-01 12:10:00
74
Standing or parking a vehicle without properly...
$65
$65
99997
7021662040
GJA3569
NY
PAS
08/27/2013
38
2DSD
ME/BE
T
57790
...
H -
38-Failure to Display Muni Rec
NaN
NaN
NaN
1900-01-01 20:51:00
NaN
NaN
NaN
NaN
99998
7021662051
GJS8022
NY
PAS
08/27/2013
38
SUBN
TOYOT
T
57790
...
H -
38-Failure to Display Muni Rec
NaN
NaN
NaN
1900-01-01 20:54:00
NaN
NaN
NaN
NaN
99999
7021662063
GFT2577
NY
PAS
08/27/2013
38
SUBN
CADIL
T
57790
...
H -
38-Failure to Display Muni Rec
NaN
NaN
NaN
1900-01-01 20:56:00
NaN
NaN
NaN
NaN
100000 rows × 48 columns
In [92]:
#How much money did NYC make off of parking violations?
new_df.columns[45]
Out[92]:
'DEFINITION'
In [93]:
#new_df['Manhattan\xa0 96th St. & below']
new_df['Manhattan\xa0 96th St. & below'] = new_df['Manhattan\xa0 96th St. & below'].astype(str)
def fine_int(fine_str):
return fine_str.replace("$","")
new_df['fine_int'] = new_df['Manhattan\xa0 96th St. & below'].apply(fine_int)
fine_sum = 0
for item in new_df['fine_int']:
if item != 'nan' and item != '100\n(Regular Tow, plus violation fine)' and item != 'vary':
int_item = int(item)
fine_sum = fine_sum + int_item
print(fine_sum)
6552720
In [94]:
#What's the most lucrative kind of parking violation?
#The most frequent?
def all_fines(fines):
return int(fines.replace("nan","0").replace('100\n(Regular Tow, plus violation fine)',"0").replace('vary','0'))
new_df['Fines'] = new_df['fine_int'].apply(all_fines)
In [95]:
new_df['Fines'].max()
Out[95]:
180
In [96]:
new_df['Fines'].value_counts()
Out[96]:
115 38346
0 32170
65 24719
95 3187
165 934
180 339
60 305
Name: Fines, dtype: int64
In [97]:
#New Jersey has bad drivers, but does it have bad parkers, too?
#How much money does NYC make off of all non-New York vehicles?
is_not_stateless = new_df['Registration State'].notnull()
df[is_not_stateless]['Registration State']
is_not_NY = ~df[is_not_stateless]['Registration State'].str.contains('NY')
new_df[is_not_stateless & is_not_NY]
Out[97]:
Summons Number
Plate ID
Registration State
Plate Type
Issue Date
Violation Code
Vehicle Body Type
Vehicle Make
Issuing Agency
Street Code1
...
No Standing or Stopping Violation
Hydrant Violation
Double Parking Violation
converted_violation_time
CODE
DEFINITION
Manhattan 96th St. & below
All Other Areas
fine_int
Fines
5
1283294217
T60DAR
NJ
PAS
08/11/2013
14
P-U
DODGE
P
37250
...
NaN
NaN
NaN
1900-01-01 18:17:00
14
General No Standing: Standing or parking where...
$115
$115
115
115
7
1283983620
XZ764G
NJ
PAS
08/07/2013
24
DELV
FORD
X
63430
...
NaN
NaN
NaN
1900-01-01 04:25:00
24
Authorized Vehicles Only: No parking where par...
$65
$60
65
65
9
1283983667
MCL78B
NJ
PAS
07/18/2013
24
SDN
SUBAR
H
0
...
NaN
NaN
NaN
1900-01-01 08:39:00
24
Authorized Vehicles Only: No parking where par...
$65
$60
65
65
17
1286246416
815M342
MD
PAS
07/30/2013
20
SUBN
SATUR
T
0
...
NaN
NaN
NaN
1900-01-01 07:24:00
20
General No Parking: No parking where parking i...
$65
$60
65
65
19
1286282330
YZY6476
NC
PAS
07/29/2013
20
SDN
NISSA
T
32030
...
NaN
NaN
NaN
1900-01-01 07:36:00
20
General No Parking: No parking where parking i...
$65
$60
65
65
20
1286282342
WBJ819
LA
PAS
08/07/2013
17
SUBN
HONDA
T
0
...
NaN
NaN
NaN
1900-01-01 08:47:00
17
Authorized Vehicles Only: Standing or parking ...
$95
$95
95
95
22
1286654920
ZTR66R
NJ
PAS
07/18/2013
50
SDN
N/S
T
0
...
NaN
NaN
NaN
1900-01-01 10:20:00
50
Stopping, standing or parking in a crosswalk. ...
$115
$115
115
115
24
1286807062
P193871
IL
PAS
08/10/2013
40
SDN
SCIO
T
26630
...
NaN
NaN
NaN
1900-01-01 10:18:00
40
Stopping, standing or parking closer than 15 f...
$115
$115
115
115
27
1286808807
HHG3545
PA
PAS
08/06/2013
20
SDN
TOYOT
T
21130
...
NaN
NaN
NaN
1900-01-01 09:15:00
20
General No Parking: No parking where parking i...
$65
$60
65
65
30
1287517304
6B22924
ID
PAS
07/22/2013
20
SDN
VOLKS
T
36250
...
NaN
NaN
NaN
1900-01-01 17:21:00
20
General No Parking: No parking where parking i...
$65
$60
65
65
31
1287517316
4135TE
ME
PAS
07/22/2013
14
SDN
TOYOT
T
0
...
NaN
NaN
NaN
1900-01-01 14:51:00
14
General No Standing: Standing or parking where...
$115
$115
115
115
32
1287518126
WMI
CT
PAS
07/24/2013
31
SUBN
ME/BE
T
34510
...
NaN
NaN
NaN
1900-01-01 16:10:00
31
Standing of a non-commercial vehicle in a comm...
$115
$115
115
115
33
1287603671
P752957
99
999
07/20/2013
85
DELV
VOLVO
T
17330
...
NaN
NaN
NaN
1900-01-01 02:46:00
85
Parking a Commercial Vehicle more than 3 hours...
$65
$65
65
65
34
1287603683
P774757
IL
PAS
03/20/2013
85
TRLR
VOLVO
T
17330
...
NaN
NaN
NaN
1900-01-01 03:00:00
85
Parking a Commercial Vehicle more than 3 hours...
$65
$65
65
65
37
1288360800
HYM4303
PA
PAS
08/06/2013
41
SDN
MITSU
P
29090
...
NaN
NaN
NaN
1900-01-01 18:18:00
NaN
NaN
nan
NaN
nan
0
38
1289971754
XDB4574
VA
PAS
08/01/2013
40
VAN
TOYOT
P
13610
...
NaN
NaN
NaN
1900-01-01 19:30:00
40
Stopping, standing or parking closer than 15 f...
$115
$115
115
115
43
1290834386
SES174
NB
PAS
08/15/2013
19
SDN
NISSA
P
49690
...
NaN
NaN
NaN
1900-01-01 10:50:00
19
Bus Stop: Standing or parking where standing i...
$115
$115
115
115
44
1291204167
JCE3366
PA
PAS
07/24/2013
74
SUBN
FORD
P
14980
...
NaN
NaN
NaN
1900-01-01 10:15:00
74
Standing or parking a vehicle without properly...
$65
$65
65
65
47
1291896399
G24BLB
NJ
PAS
07/19/2013
40
SDN
INFIN
P
41900
...
NaN
NaN
NaN
1900-01-01 11:35:00
40
Stopping, standing or parking closer than 15 f...
$115
$115
115
115
51
6020309034
GEW4836
99
PAS
07/18/2013
94
SDN
ACURA
X
0
...
NaN
NaN
NaN
NaT
94
Vehicle Release Agreement code associated with...
100\n(Regular Tow, plus violation fine)
$200 (Heavy Tow, plus violation fine)
100\n(Regular Tow, plus violation fine)
0
52
1292755064
904YDS
CT
PAS
07/14/2013
19
SDN
VOLVO
X
54580
...
NaN
NaN
NaN
1900-01-01 18:10:00
19
Bus Stop: Standing or parking where standing i...
$115
$115
115
115
53
1292756792
GDX8921
99
PAS
07/15/2013
19
SDN
HONDA
X
28790
...
NaN
NaN
NaN
1900-01-01 10:53:00
19
Bus Stop: Standing or parking where standing i...
$115
$115
115
115
54
1292757050
S206498
IL
PAS
07/24/2013
19
NaN
BMW
X
0
...
NaN
NaN
NaN
1900-01-01 10:14:00
19
Bus Stop: Standing or parking where standing i...
$115
$115
115
115
57
1293094389
GDS9810
NJ
PAS
06/20/2013
31
SDN
BMW
P
24890
...
NaN
NaN
NaN
1900-01-01 17:32:00
31
Standing of a non-commercial vehicle in a comm...
$115
$115
115
115
66
1294202492
XD377T
NJ
PAS
07/25/2013
46
TRLR
MITSU
X
0
...
NaN
NaN
NaN
1900-01-01 09:53:00
46
Standing or parking on the roadway side of a v...
$115
$115
115
115
67
1294364133
4BXK89
MD
PAS
08/13/2013
21
SDN
CHEVR
S
56590
...
NaN
NaN
NaN
1900-01-01 11:45:00
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
68
1294364145
IHR526
SC
PAS
08/13/2013
21
SDN
INFIN
S
50303
...
NaN
NaN
NaN
1900-01-01 11:55:00
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
69
1294712196
V71CRE
NJ
PAS
07/02/2013
17
SDN
TOYOT
P
14510
...
NaN
NaN
NaN
1900-01-01 01:45:00
17
Authorized Vehicles Only: Standing or parking ...
$95
$95
95
95
70
1294712202
U95CLJ
99
PAS
08/04/2013
17
SDN
HONDA
P
14510
...
NaN
NaN
NaN
1900-01-01 14:20:00
17
Authorized Vehicles Only: Standing or parking ...
$95
$95
95
95
71
1294712627
482YAO
CT
PAS
08/07/2013
17
SDN
ACURA
P
14510
...
NaN
NaN
NaN
1900-01-01 09:20:00
17
Authorized Vehicles Only: Standing or parking ...
$95
$95
95
95
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
99879
7020980650
950ZRU
CT
PAS
08/23/2013
21
4DSD
ME/BE
T
40930
...
NaN
NaN
NaN
1900-01-01 03:09:00
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
99880
7020980685
YBG95A
NJ
PAS
08/23/2013
40
SUBN
FORD
T
35030
...
NaN
NaN
NaN
1900-01-01 23:11:00
40
Stopping, standing or parking closer than 15 f...
$115
$115
115
115
99883
7020980739
517GT7
MA
PAS
08/24/2013
21
4DSD
LEXUS
T
28830
...
NaN
NaN
NaN
NaT
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
99884
7020980740
XAE7887
VA
PAS
08/24/2013
21
SUBN
FORD
T
28830
...
NaN
NaN
NaN
NaT
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
99885
7020980764
MAN930
FL
PAS
08/24/2013
21
4DSD
CADIL
T
28830
...
NaN
NaN
NaN
NaT
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
99887
7020980790
L924413
IL
PAS
08/24/2013
21
SUBN
ME/BE
T
28830
...
NaN
NaN
NaN
NaT
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
99888
7020980806
4703DLC
NJ
PAS
08/24/2013
21
SUBN
HONDA
T
28830
...
NaN
NaN
NaN
NaT
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
99892
7020980880
W24CXJ
NJ
PAS
08/24/2013
21
4DSD
BMW
T
28830
...
NaN
NaN
NaN
NaT
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
99894
7020980910
526ZJV
CT
PAS
08/24/2013
21
SUBN
HONDA
T
26230
...
NaN
NaN
NaN
1900-01-01 01:16:00
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
99895
7020980946
S05FCR
TX
PAS
08/24/2013
21
4DSD
KIA
T
69530
...
NaN
NaN
NaN
1900-01-01 01:35:00
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
99896
7020980958
595YDK
FL
PAS
08/24/2013
21
4DSD
BMW
T
69530
...
NaN
NaN
NaN
1900-01-01 01:38:00
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
99898
7020981008
V65DFJ
NJ
PAS
08/24/2013
21
4DSD
NISSA
T
40930
...
NaN
NaN
NaN
1900-01-01 03:17:00
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
99899
7020981033
WVZ6982
VA
PAS
08/27/2013
38
4DSD
HONDA
T
13230
...
NaN
NaN
NaN
1900-01-01 21:11:00
NaN
NaN
nan
NaN
nan
0
99903
7020981082
XY769K
NJ
PAS
08/27/2013
78
DELV
FORD
T
26730
...
NaN
NaN
NaN
1900-01-01 22:24:00
78
Parking a Commercial Vehicle on a residential ...
$65
$65
65
65
99906
7020981136
TAW82C
NJ
PAS
08/27/2013
66
TRLR
NS/OT
T
93230
...
NaN
NaN
NaN
1900-01-01 23:21:00
66
Parking a trailer or semi-trailer which is not...
$65
$45
65
65
99912
7021659910
JFJ5373
PA
PAS
07/29/2013
21
4DSD
HONDA
T
24040
...
NaN
NaN
NaN
1900-01-01 10:38:00
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
99913
7021659921
XCB9739
VA
PAS
07/29/2013
21
4DSD
TOYOT
T
15940
...
NaN
NaN
NaN
1900-01-01 10:41:00
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
99926
7021660212
463TKM
CT
PAS
08/03/2013
21
4DSD
NISSA
T
51090
...
NaN
NaN
NaN
1900-01-01 08:42:00
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
99927
7021660248
6XKN019
CA
PAS
08/03/2013
21
2DSD
MINI
T
51090
...
NaN
NaN
NaN
1900-01-01 08:46:00
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
99929
7021660285
JCT7880
PA
PAS
08/03/2013
21
4DSD
SUBAR
T
53490
...
NaN
NaN
NaN
1900-01-01 09:38:00
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
99938
7021660522
797RBR
CT
PAS
08/05/2013
21
4DSD
HONDA
T
47195
...
NaN
NaN
NaN
1900-01-01 08:37:00
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
99941
7021660613
STL3800
NC
PAS
08/08/2013
50
SUBN
TOYOT
T
0
...
NaN
NaN
NaN
1900-01-01 21:04:00
50
Stopping, standing or parking in a crosswalk. ...
$115
$115
115
115
99945
7021660716
503ICU
FL
PAS
08/08/2013
50
SUBN
FORD
T
0
...
NaN
NaN
NaN
1900-01-01 22:07:00
50
Stopping, standing or parking in a crosswalk. ...
$115
$115
115
115
99952
7021660972
KHD9569
VA
PAS
08/12/2013
21
4DSD
CHRYS
T
47195
...
NaN
NaN
NaN
1900-01-01 08:45:00
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
99954
7021661010
6WPH966
CA
PAS
08/19/2013
40
4DSD
TOYOT
T
15740
...
NaN
NaN
NaN
1900-01-01 05:50:00
40
Stopping, standing or parking closer than 15 f...
$115
$115
115
115
99958
7021661216
JFJ9595
PR
PAS
08/19/2013
40
4DSD
MERCU
T
24440
...
NaN
NaN
NaN
1900-01-01 09:18:00
40
Stopping, standing or parking closer than 15 f...
$115
$115
115
115
99966
7021661400
WX6BJH
GA
PAS
08/24/2013
51
VAN
CHEVR
T
20240
...
NaN
NaN
NaN
1900-01-01 07:57:00
51
Stopping, standing or parking on a sidewalk.
$115
$115
115
115
99967
7021661411
H487RA
FL
PAS
08/24/2013
51
SUBN
LINCO
T
20240
...
NaN
NaN
NaN
1900-01-01 08:01:00
51
Stopping, standing or parking on a sidewalk.
$115
$115
115
115
99971
7021661678
PD861B
FL
PAS
08/26/2013
21
4DSD
HONDA
T
25240
...
NaN
NaN
NaN
1900-01-01 08:10:00
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
99983
7021661873
R418032
IL
PAS
08/27/2013
37
SUBN
FORD
T
23040
...
NaN
NaN
NaN
1900-01-01 10:25:00
NaN
NaN
nan
NaN
nan
0
28939 rows × 50 columns
In [98]:
new_df[is_not_stateless & is_not_NY]['Fines']
Out[98]:
5 115
7 65
9 65
17 65
19 65
20 95
22 115
24 115
27 65
30 65
31 115
32 115
33 65
34 65
37 0
38 115
43 115
44 65
47 115
51 0
52 115
53 115
54 115
57 115
66 115
67 65
68 65
69 95
70 95
71 95
...
99879 65
99880 115
99883 65
99884 65
99885 65
99887 65
99888 65
99892 65
99894 65
99895 65
99896 65
99898 65
99899 0
99903 65
99906 65
99912 65
99913 65
99926 65
99927 65
99929 65
99938 65
99941 115
99945 115
99952 65
99954 115
99958 115
99966 115
99967 115
99971 65
99983 0
Name: Fines, dtype: int64
In [99]:
#Make a chart of the top few.
new_df[is_not_stateless & is_not_NY]['Fines'].sort_values(ascending=False)
#Why aren't the $180 lumped together?
Out[99]:
21302 180
41663 180
37952 180
47071 180
26289 180
1718 180
7671 180
8005 180
62578 180
35382 180
5686 180
40367 180
16719 180
28409 180
20021 180
28408 180
36298 180
28407 180
8711 180
26330 180
63662 180
1963 180
17800 180
8648 180
35107 180
9986 180
20938 180
20949 180
17819 180
17201 180
...
81714 0
81741 0
81413 0
81412 0
81411 0
81395 0
81166 0
81168 0
81174 0
81175 0
81184 0
39579 0
81213 0
39558 0
81215 0
39553 0
81216 0
81219 0
81221 0
81234 0
81246 0
39511 0
81247 0
81302 0
81318 0
81327 0
81352 0
81354 0
81393 0
99983 0
Name: Fines, dtype: int64
In [100]:
#What time of day do people usually get their tickets?
#You can break the day up into several blocks -
#for example 12am-6am, 6am-12pm, 12pm-6pm, 6pm-12am.
#new_df['Violation Time']
In [101]:
#What's the average ticket cost in NYC?
new_df['Fines'].describe()
Out[101]:
count 100000.000000
mean 65.527200
std 49.845475
min 0.000000
25% 0.000000
50% 65.000000
75% 115.000000
max 180.000000
Name: Fines, dtype: float64
In [102]:
#Make a graph of the number of tickets per day.
new_df['Issue Date'].value_counts().head().plot(kind='barh')
Out[102]:
<matplotlib.axes._subplots.AxesSubplot at 0x12189e4a8>
In [103]:
#Make a graph of the amount of revenue collected per day.
new_df.groupby('Issue Date')['Fines'].sum().sort_values(ascending=False).head().plot(kind='barh')
#What is groupby again?
Out[103]:
<matplotlib.axes._subplots.AxesSubplot at 0x1218a3ba8>
In [104]:
#Manually construct a dataframe out of
#https://dmv.ny.gov/statistic/2015licinforce-web.pdf
#(only NYC boroughts - bronx, queens, manhattan, staten island, brooklyn), having columns for borough name, abbreviation,
#and number of licensed drivers.
df_dmv = pd.read_csv("dmv.csv")
#How to get the full name of each borough?
In [105]:
df_dmv.head()
Out[105]:
Borough
Total
0
BX
456847
1
K
983769
2
NY
748583
3
Q
1134064
4
R
304250
In [106]:
#What's the parking-ticket-$-per-licensed-driver in
#each borough of NYC? Do this with pandas and the
#dataframe you just made, not with your head!
#I DON'T KNOW HOW TO DO THIS
In [107]:
newest_df = new_df.merge(df_dmv, left_on='Violation County', right_on='Borough', how='left')
newest_df
Out[107]:
Summons Number
Plate ID
Registration State
Plate Type
Issue Date
Violation Code
Vehicle Body Type
Vehicle Make
Issuing Agency
Street Code1
...
Double Parking Violation
converted_violation_time
CODE
DEFINITION
Manhattan 96th St. & below
All Other Areas
fine_int
Fines
Borough
Total
0
1283294138
GBB9093
NY
PAS
08/04/2013
46
SUBN
AUDI
P
37250
...
NaN
1900-01-01 07:52:00
46
Standing or parking on the roadway side of a v...
$115
$115
115
115
NaN
NaN
1
1283294151
62416MB
NY
COM
08/04/2013
46
VAN
FORD
P
37290
...
NaN
1900-01-01 12:40:00
46
Standing or parking on the roadway side of a v...
$115
$115
115
115
NY
748583.0
2
1283294163
78755JZ
NY
COM
08/05/2013
46
P-U
CHEVR
P
37030
...
NaN
1900-01-01 12:43:00
46
Standing or parking on the roadway side of a v...
$115
$115
115
115
NY
748583.0
3
1283294175
63009MA
NY
COM
08/05/2013
46
VAN
FORD
P
37270
...
NaN
1900-01-01 14:32:00
46
Standing or parking on the roadway side of a v...
$115
$115
115
115
NY
748583.0
4
1283294187
91648MC
NY
COM
08/08/2013
41
TRLR
GMC
P
37240
...
NaN
1900-01-01 12:39:00
NaN
NaN
nan
NaN
nan
0
NY
748583.0
5
1283294217
T60DAR
NJ
PAS
08/11/2013
14
P-U
DODGE
P
37250
...
NaN
1900-01-01 18:17:00
14
General No Standing: Standing or parking where...
$115
$115
115
115
NY
748583.0
6
1283294229
GCR2838
NY
PAS
08/11/2013
14
VAN
NaN
P
37250
...
NaN
1900-01-01 19:41:00
14
General No Standing: Standing or parking where...
$115
$115
115
115
NY
748583.0
7
1283983620
XZ764G
NJ
PAS
08/07/2013
24
DELV
FORD
X
63430
...
NaN
1900-01-01 04:25:00
24
Authorized Vehicles Only: No parking where par...
$65
$60
65
65
K
983769.0
8
1283983631
GBH9379
NY
PAS
08/07/2013
24
SDN
TOYOT
X
63430
...
NaN
1900-01-01 04:37:00
24
Authorized Vehicles Only: No parking where par...
$65
$60
65
65
K
983769.0
9
1283983667
MCL78B
NJ
PAS
07/18/2013
24
SDN
SUBAR
H
0
...
NaN
1900-01-01 08:39:00
24
Authorized Vehicles Only: No parking where par...
$65
$60
65
65
K
983769.0
10
1283983679
M367CN
NY
PAS
07/18/2013
24
SDN
HYUND
H
0
...
NaN
1900-01-01 08:45:00
24
Authorized Vehicles Only: No parking where par...
$65
$60
65
65
K
983769.0
11
1283983734
GAR6813
NY
PAS
07/18/2013
24
SDN
TOYOT
H
0
...
NaN
1900-01-01 09:07:00
24
Authorized Vehicles Only: No parking where par...
$65
$60
65
65
K
983769.0
12
1283983771
GEN8674
NY
PAS
07/31/2013
24
SDN
AUDI
X
0
...
NaN
1900-01-01 17:14:00
24
Authorized Vehicles Only: No parking where par...
$65
$60
65
65
K
983769.0
13
1283983825
GAC2703
NY
PAS
08/12/2013
24
SDN
NISSA
X
23230
...
NaN
1900-01-01 18:56:00
24
Authorized Vehicles Only: No parking where par...
$65
$60
65
65
K
983769.0
14
1286036800
40793JY
NY
COM
07/05/2013
14
VAN
CHEVR
P
34190
...
NaN
1900-01-01 23:45:00
14
General No Standing: Standing or parking where...
$115
$115
115
115
NaN
NaN
15
1286123550
GAD1485
NY
PAS
08/12/2013
20
SDN
VOLKS
T
28930
...
NaN
1900-01-01 17:46:00
20
General No Parking: No parking where parking i...
$65
$60
65
65
K
983769.0
16
1286246398
GFC5338
NY
PAS
07/26/2013
14
SDN
TOYOT
T
0
...
NaN
1900-01-01 11:42:00
14
General No Standing: Standing or parking where...
$115
$115
115
115
K
983769.0
17
1286246416
815M342
MD
PAS
07/30/2013
20
SUBN
SATUR
T
0
...
NaN
1900-01-01 07:24:00
20
General No Parking: No parking where parking i...
$65
$60
65
65
K
983769.0
18
1286248000
GJA3452
NY
PAS
07/23/2013
14
SDN
KIA
T
73690
...
NaN
1900-01-01 07:58:00
14
General No Standing: Standing or parking where...
$115
$115
115
115
K
983769.0
19
1286282330
YZY6476
NC
PAS
07/29/2013
20
SDN
NISSA
T
32030
...
NaN
1900-01-01 07:36:00
20
General No Parking: No parking where parking i...
$65
$60
65
65
K
983769.0
20
1286282342
WBJ819
LA
PAS
08/07/2013
17
SUBN
HONDA
T
0
...
NaN
1900-01-01 08:47:00
17
Authorized Vehicles Only: Standing or parking ...
$95
$95
95
95
K
983769.0
21
1286289841
GAV9235
NY
PAS
07/20/2013
50
SDN
HONDA
T
0
...
NaN
1900-01-01 11:20:00
50
Stopping, standing or parking in a crosswalk. ...
$115
$115
115
115
K
983769.0
22
1286654920
ZTR66R
NJ
PAS
07/18/2013
50
SDN
N/S
T
0
...
NaN
1900-01-01 10:20:00
50
Stopping, standing or parking in a crosswalk. ...
$115
$115
115
115
NY
748583.0
23
1286799648
GDE3973
NY
PAS
07/20/2013
40
SDN
TOYOT
T
0
...
NaN
1900-01-01 15:24:00
40
Stopping, standing or parking closer than 15 f...
$115
$115
115
115
NY
748583.0
24
1286807062
P193871
IL
PAS
08/10/2013
40
SDN
SCIO
T
26630
...
NaN
1900-01-01 10:18:00
40
Stopping, standing or parking closer than 15 f...
$115
$115
115
115
K
983769.0
25
1286807475
GGL6608
NY
PAS
07/26/2013
40
SDN
NISSA
T
73650
...
NaN
1900-01-01 07:43:00
40
Stopping, standing or parking closer than 15 f...
$115
$115
115
115
K
983769.0
26
1286807633
84301JU
NY
COM
07/19/2013
14
P-U
DODGE
X
63030
...
NaN
1900-01-01 08:50:00
14
General No Standing: Standing or parking where...
$115
$115
115
115
K
983769.0
27
1286808807
HHG3545
PA
PAS
08/06/2013
20
SDN
TOYOT
T
21130
...
NaN
1900-01-01 09:15:00
20
General No Parking: No parking where parking i...
$65
$60
65
65
K
983769.0
28
1287320491
50097JX
NY
COM
08/07/2013
40
VAN
MERCU
T
23190
...
NaN
1900-01-01 10:23:00
40
Stopping, standing or parking closer than 15 f...
$115
$115
115
115
NY
748583.0
29
1287320570
GEJ9154
NY
PAS
08/06/2013
51
VAN
TOYOT
X
93230
...
NaN
1900-01-01 11:20:00
51
Stopping, standing or parking on a sidewalk.
$115
$115
115
115
K
983769.0
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
99970
7021661666
GCN6488
NY
PAS
08/26/2013
21
SUBN
DODGE
T
50290
...
NaN
1900-01-01 08:06:00
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
Q
1134064.0
99971
7021661678
PD861B
FL
PAS
08/26/2013
21
4DSD
HONDA
T
25240
...
NaN
1900-01-01 08:10:00
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
Q
1134064.0
99972
7021661708
GEM5459
NY
PAS
08/26/2013
21
4DSD
TOYOT
T
25240
...
NaN
1900-01-01 08:15:00
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
Q
1134064.0
99973
7021661733
GHL3207
NY
PAS
08/26/2013
21
2DSD
HONDA
T
24540
...
NaN
1900-01-01 08:37:00
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
Q
1134064.0
99974
7021661745
GGP4922
NY
PAS
08/26/2013
21
4DSD
TOYOT
T
24440
...
NaN
1900-01-01 08:39:00
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
Q
1134064.0
99975
7021661769
GED9571
NY
PAS
08/26/2013
21
4DSD
NISSA
T
24590
...
NaN
1900-01-01 08:43:00
21
Street Cleaning: No parking where parking is n...
$65
$45
65
65
Q
1134064.0
99976
7021661782
nan
NY
999
08/27/2013
74
4DSD
NISSA
T
49690
...
NaN
1900-01-01 07:47:00
74
Standing or parking a vehicle without properly...
$65
$65
65
65
Q
1134064.0
99977
7021661794
nan
NY
999
08/27/2013
51
4DSD
NISSA
T
49690
...
NaN
1900-01-01 07:59:00
51
Stopping, standing or parking on a sidewalk.
$115
$115
115
115
Q
1134064.0
99978
7021661800
nan
NY
999
08/27/2013
51
4DSD
NISSA
T
49690
...
NaN
1900-01-01 08:17:00
51
Stopping, standing or parking on a sidewalk.
$115
$115
115
115
Q
1134064.0
99979
7021661812
nan
NY
PAS
08/27/2013
74
4DSD
NISSA
T
49690
...
NaN
1900-01-01 08:40:00
74
Standing or parking a vehicle without properly...
$65
$65
65
65
Q
1134064.0
99980
7021661824
nan
NY
PAS
08/27/2013
51
4DSD
NISSA
T
49690
...
NaN
1900-01-01 08:49:00
51
Stopping, standing or parking on a sidewalk.
$115
$115
115
115
Q
1134064.0
99981
7021661848
T491409C
NY
OMT
08/27/2013
37
4DSD
LINCO
T
23290
...
NaN
1900-01-01 10:02:00
NaN
NaN
nan
NaN
nan
0
Q
1134064.0
99982
7021661861
67733MC8
NY
COM
08/27/2013
38
R/RD
INTER
T
49690
...
NaN
1900-01-01 10:14:00
NaN
NaN
nan
NaN
nan
0
Q
1134064.0
99983
7021661873
R418032
IL
PAS
08/27/2013
37
SUBN
FORD
T
23040
...
NaN
1900-01-01 10:25:00
NaN
NaN
nan
NaN
nan
0
Q
1134064.0
99984
7021661885
GHW1112
NY
PAS
08/27/2013
70
4DSD
NISSA
T
22940
...
NaN
1900-01-01 10:58:00
70
Standing or parking a vehicle without showing ...
$65
$65
65
65
Q
1134064.0
99985
7021661897
nan
NY
PAS
08/27/2013
70
NaN
NaN
T
22940
...
NaN
1900-01-01 11:23:00
70
Standing or parking a vehicle without showing ...
$65
$65
65
65
Q
1134064.0
99986
7021661915
nan
NY
PAS
08/27/2013
51
4DSD
NISSA
T
23490
...
NaN
1900-01-01 11:34:00
51
Stopping, standing or parking on a sidewalk.
$115
$115
115
115
Q
1134064.0
99987
7021661927
nan
NY
PAS
08/27/2013
74
4DSD
NISSA
T
23490
...
NaN
1900-01-01 11:37:00
74
Standing or parking a vehicle without properly...
$65
$65
65
65
Q
1134064.0
99988
7021661939
nan
NY
PAS
08/27/2013
51
4DSD
NISSA
T
23490
...
NaN
1900-01-01 11:39:00
51
Stopping, standing or parking on a sidewalk.
$115
$115
115
115
Q
1134064.0
99989
7021661940
nan
NY
PAS
08/27/2013
74
4DSD
NISSA
T
23490
...
NaN
1900-01-01 11:41:00
74
Standing or parking a vehicle without properly...
$65
$65
65
65
Q
1134064.0
99990
7021661952
nan
NY
PAS
08/27/2013
51
4DSD
NISSA
T
23490
...
NaN
1900-01-01 11:44:00
51
Stopping, standing or parking on a sidewalk.
$115
$115
115
115
Q
1134064.0
99991
7021661964
42103JM
NY
COM
08/27/2013
19
DELV
FRUEH
T
49690
...
NaN
1900-01-01 11:51:00
19
Bus Stop: Standing or parking where standing i...
$115
$115
115
115
Q
1134064.0
99992
7021661976
nan
NY
PAS
08/27/2013
74
4DSD
NISSA
T
24090
...
NaN
1900-01-01 12:00:00
74
Standing or parking a vehicle without properly...
$65
$65
65
65
Q
1134064.0
99993
7021661988
nan
NY
PAS
08/27/2013
51
4DSD
NISSA
T
24090
...
NaN
1900-01-01 12:03:00
51
Stopping, standing or parking on a sidewalk.
$115
$115
115
115
Q
1134064.0
99994
7021661990
nan
NY
PAS
08/27/2013
74
4DSD
HONDA
T
24090
...
NaN
1900-01-01 12:06:00
74
Standing or parking a vehicle without properly...
$65
$65
65
65
Q
1134064.0
99995
7021662002
nan
NY
PAS
08/27/2013
51
4DSD
HONDA
T
24090
...
NaN
1900-01-01 12:08:00
51
Stopping, standing or parking on a sidewalk.
$115
$115
115
115
Q
1134064.0
99996
7021662014
nan
NY
PAS
08/27/2013
74
4DSD
HONDA
T
24090
...
NaN
1900-01-01 12:10:00
74
Standing or parking a vehicle without properly...
$65
$65
65
65
Q
1134064.0
99997
7021662040
GJA3569
NY
PAS
08/27/2013
38
2DSD
ME/BE
T
57790
...
NaN
1900-01-01 20:51:00
NaN
NaN
nan
NaN
nan
0
Q
1134064.0
99998
7021662051
GJS8022
NY
PAS
08/27/2013
38
SUBN
TOYOT
T
57790
...
NaN
1900-01-01 20:54:00
NaN
NaN
nan
NaN
nan
0
Q
1134064.0
99999
7021662063
GFT2577
NY
PAS
08/27/2013
38
SUBN
CADIL
T
57790
...
NaN
1900-01-01 20:56:00
NaN
NaN
nan
NaN
nan
0
Q
1134064.0
100000 rows × 52 columns
In [108]:
newest_df['Violation County'].value_counts()
Out[108]:
NY 31083
K 15794
Q 12943
BX 8760
R 2504
RICH 1
BRONX 1
Name: Violation County, dtype: int64
In [121]:
Out[121]:
0
In [ ]:
Content source: honjy/foundations-homework
Similar notebooks: