Question: First, write the code to create a single DataFrame object in a function called load_ticket_data(). This function should return the full dataframe and take

First, write the code to create a single DataFrame object in a function called load_ticket_data(). This Write a function called generate_descriptors (df) which takes in the DataFrame you loaded from Question and

First, write the code to create a single DataFrame object in a function called load_ticket_data(). This function should return the full dataframe and take no parameters (you can assume the ticket files are in the same directory as your assignment notebook). Column labels should be as follows: 'Make', 'Model', 'Violation', Description', 'Location', 'Meter', ['Ticket #', 'Badge', 'Issue Date', 'IssueTime', 'Plate', 'State', Fine', 'Penalty'] Here are some hints. 1. Be sure to scroll through every single sheet to make sure what rows should be dropped. 2. Make sure to exclude unnecessary footers and headers from the datafile. 3. Check if your header labels are correct. Write a function called generate_descriptors (df) which takes in the DataFrame you loaded from Question and returns a dataframe of all unique ticket descriptions and how frequent they are (e.g. it will tell you how many "HANDICAP" or "NO PERMITS U/M" tickets have been issued) for each of the following three time periods: morning (3 am to 11:59 am), afternoon (12 pm - 5:59 pm), and evening (6 pm - 2:59 am). Make sure you drop na values of input df. The DataFrame which generate_descriptors (df) returns should have 3 rows and 51 columns. Index should be labelled as Morning, Afternoon, and Evening. Column names should be unique values of df ["Description"]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Python import pandas as pd def loadticketdata Read all sheets from the Excel file into a list of dat... View full answer

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 Programming Questions!