Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

Python import pandas as pd def loadticketdata Read all sheets from the Excel file into a list of dat... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Primer Plus

Authors: Stephen Prata

6th Edition

978-0321776402, 0321776402

Students also viewed these Programming questions