subject

Two functions require that each function process the dictionaries' dates. These dates are the values associated with the key 'tow_date'. The dates are stored as strings and use a fixed-position format. This format makes finding information easy. For example, if a variable val was assigned to a value associated with the key 'tow_date', we can get the month and date using:

month = int(val[5]+val[6]) # Concatenates & converts month's digits

day = int(val[8]+val[9]) # Concatenates & converts days's digits

count_by_month

Define a function named count_by_month with one parameter. This parameter will be a list of dictionaries (the data). This function must return a list with a length of 12 containing the number of dictionaries with that 'tow_date' month. Remember to adjust for how we use lists (for example, January is month 1 but its count is the list's entry at index 0). You SHOULD assume that all dictionaries in the parameter will have 'tow_date'as a key.

Sample function call: count_by_month(data)

count_by_day

Define a function named count_by_day with one parameter. This parameter will be a list of dictionaries (the data). This function must return a list with a length of 31 containing the number of dictionaries with that 'tow_date' day. Remember to adjust for how we use lists (for example, the first day of each month is day 1 but its count is the list's entry at index 0). You SHOULD assume that all dictionaries in the parameter will have 'tow_date'as a key.

Sample function call: count_by_day(data)

DATA IS DEFINED BELOW

data = [ {'unique_key': '201209064DPE', 'tow_date': '2012-09-06T00:00:00.000', 'agency': 'DPE', 'vehicle_year': 0, 'vehicle_make': 'MINI', 'tow_location': 'MAIN/CUSTER', 'city': 'Buffalo', 'state': 'NY', 'zip': '14214', 'tow_reason': 'AI', 'tow_description': 'ACCIDENT', 'location_1': "{'latitude': '42.950029001582', 'longitude': '-78.827175001441'}", 'latitude': 42.95002900158201, 'longitude': -78.827175001441, 'council_district': 'UNIVERSITY', 'police_district': 'District E', 'census_tract': '47', 'census_block_group': '5', 'census_block': '5003', 'neighborhood': 'UNKNOWN'},

{'unique_key': '200801247RON', 'tow_date': '2008-01-24T00:00:00.000', 'agency': 'RON', 'vehicle_year': 1995, 'vehicle_make': 'CHEV', 'license_state': 'NY', 'tow_location': '191 14TH', 'city': 'Buffalo', 'state': 'NY', 'zip': '14213', 'tow_reason': 'IP', 'tow_description': 'ILLEGALLY PARKED', 'location_1': "{'latitude': '42.906118854478', 'longitude': '-78.886454771174'}", 'latitude': 42.90611885447759, 'longitude': -78.88645477117358, 'council_district': 'NIAGARA', 'police_district': 'District B', 'census_tract': '69.02', 'census_block_group': '1', 'census_block': '1004', 'neighborhood': 'UNKNOWN'},

{'unique_key': '201308292RIV', 'tow_date': '2013-08-29T00:00:00.000', 'agency': 'RIV', 'vehicle_year': 2000, 'vehicle_make': 'BUIC', 'license_state': 'NY', 'tow_location': '98 GREENWOOD', 'city': 'Buffalo', 'state': 'NY', 'zip': '14213', 'tow_reason': 'IP', 'tow_description': 'ILLEGALLY PARKED', 'location_1': "{'latitude': '42.92264365562', 'longitude': '-78.888887800432'}", 'latitude': 42.922643655619744, 'longitude': -78.88888780043183, 'council_district': 'NIAGARA', 'police_district': 'District D', 'census_tract': '171', 'census_block_group': '3', 'census_block': '3004', 'neighborhood': 'UNKNOWN'},

{'unique_key': '2010040512DPE', 'tow_date': '2010-04-05T00:00:00.000', 'agency': 'DPE', 'vehicle_year': 1998, 'vehicle_make': 'CHEV', 'license_state': 'NY', 'tow_location': 'SMITH/CLINTON', 'city': 'Buffalo', 'state': 'NY', 'zip': '14210', 'tow_reason': 'IL', 'tow_description': 'ILLEGAL VEHICLE', 'location_1': "{'latitude': '42.880136970577', 'longitude': '-78.844075992214'}", 'latitude': 42.88013697057658, 'longitude': -78.84407599221383, 'council_district': 'FILLMORE', 'police_district': 'District C', 'census_tract': '15', 'census_block_group': '1', 'census_block': '1029', 'neighborhood': 'UNKNOWN'}]

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 21:40, jacelee17631
Write c function that can replace all the positive elements to 0 and negative to 1 in undefined length one-dimensional array. test your program in the main program by defining one-dimensional array of 6 elements
Answers: 1
image
Computers and Technology, 22.06.2019 10:30, dreyes439
You are almost finished updating a web site. as part of the update, you have converted all pages from html 4.0 to html5. the project is currently on schedule. however, your project manager has been asked by the marketing team manager to justify a day of time spent validating the site's html5 pages. the marketing team manager does not have technical knowledge of the internet or the web. which is the most appropriate explanation to provide to the marketing team manager?
Answers: 1
image
Computers and Technology, 22.06.2019 16:00, sdonachy7
You have inserted new slides based on a word outline. how do you format these new slides to match the powerpoint presentation formatting? a. select all slides in the presentation and click format on the home tab. b. select the new slides and click reset on the home tab. c. select all slides in the presentation and click reset on the home tab. d. select the new slides and click format on the home tab.
Answers: 3
image
Computers and Technology, 23.06.2019 22:00, bb1593
Jackson, who works in the finance department of a company, is holding a seminar for other employees on how to file taxes. only three employees sign up to attend the seminar. which device can he use to share his presentation with a group of three employees?
Answers: 1
You know the right answer?
Two functions require that each function process the dictionaries' dates. These dates are the values...

Questions in other subjects: