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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 04:00
Chloe is building a kiosk-based excel application. she wants to make some modifications to the screen elements in order to keep users from being distracted by parts of the application that are irrelevant to her application. she turns to henry for guidance as she knows he built a similar solution earlier this year.chloe has decided to hide the worksheet gridlines and the vertical scroll bar. what does henry tell her to use to do this? a) screen elements dialog boxb) display options dialog boxc) customization dialog boxd) excel options dialog box
Answers: 2
question
Computers and Technology, 22.06.2019 04:30
There is a simple pattern for determining if a binary number is odd. what is it and why does this pattern occur? how many bits would you need if you wanted to have the ability to count up to 1000? how high could you count in binary if you used all 10 of your fingers as bits? (finger up means 1, finger down means 0)
Answers: 3
question
Computers and Technology, 22.06.2019 11:30
Write a function so that the main program below can be replaced by the simpler code that calls function original main program: miles_per_hour = float( minutes_traveled = float( hours_traveled = minutes_traveled / 60.0 miles_traveled = hours_traveled * miles_per_hour print('miles: %f' % miles_traveled) sample output with inputs: 70.0 100.0 miles: 116.666667
Answers: 3
question
Computers and Technology, 22.06.2019 21:50
Answer the following questions regarding your system by using the commands listed in this chapter. for each question, write the command you used to obtain the answer. a. what are the total number of inodes in the root filesystem? how many are currently utilized? how many are available for use? b. what filesystems are currently mounted on your system? c. what filesystems are available to be mounted on your system? d. what filesystems will be automatically mounted at boot time?
Answers: 1
You know the right answer?
Two functions require that each function process the dictionaries' dates. These dates are the values...
Questions
Questions on the website: 13722367