Question: Can i get the full code? Thanks a lot Question B2: CSV file [2 points] Write Python code that reads the file drug_arrests.csv and produces

Can i get the full code?

Thanks a lotCan i get the full code? Thanks a lot Question B2: CSV

Question B2: CSV file [2 points] Write Python code that reads the file drug_arrests.csv and produces two lists dates should be a list of integers from the year column in the file (as integers) arrests should be a list of arrests for marijuana posession from the arrests column in the file, as integers import csv with open ( 'drug_arrests.csv') as csvfile: readCSV - csv.reader (csvfile, delimiter-',') dates-[ arrests[1 for row in readCSV: dint (row[ 1]) dates.append (d) if 'marijuana' in row[2]: a-int (row[0]) arrests.append (a) print (dates) print (arrests) raise NotImplementedError() ValueError ipython-input-226-b93366126246> in () Traceback (most recent call last) 5 arrests[] for row in readcSV: d - int (row[1]) dates.append (d) if 'marijuana' in row[ 2 ] : ValueBrror: invalid literal for int() with base 10: 'arrests Here are some sample test cases to help check you have read the data in correctly. dates [ 0] 1990 IndexError ipython-input-227-a35238f3ae87> in module> Traceback (most recent call last) --> 1 dates [0] =-1990 IndexError: list index out of range arrests[0] 20940

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!