Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab Assignment Prompt: Analyze Customer Satisfaction Ratings Every time you visit your favorite restaurant, The Happy, Eccentric Eatery (THEE), the dining room does not seem

Lab Assignment Prompt: Analyze Customer Satisfaction Ratings Every time you visit your favorite restaurant, The Happy, Eccentric Eatery (THEE), the dining room does not seem to be busy. Perhaps THEE is losing business, and you would like to understand why.

Like many businesses, the restaurant collects data from online reputation sites. THEE is having trouble with a CSV file because some of the data in a column is corrupt.

You offer to help fix the problem for them in exchange for a free drink the next time you visit. The business agrees, and they send you their ratings data file: unit_7_restaurant_rating.csv

Your task is to import the CSV file into your Python environment, replace the corrupt data with good data, and output a new CSV file with the corrected information.

Your solution must meet the following requirements:

1. Use the popular third-party Pandas library or the Python CSV module to help implement your solution. Hint: If you decide to use the Python CSV module, you will most likely need to utilize a dictionary in combination with indexing as part of your solution. A Pandas-based solution will not require this.

2. It must check all of the data contained in the Worth_the_price column. This is the column with the corrupt data in it. In the unit_7_restaurant_rating.csv file, the corrupt data in this column contains 45, but it should contain no, thus you will need to replace each of the 45 values with no and then save all of the data to a new CSV file.

3. It must be implemented as a function that could be used for correcting data inside ANY CSV file, with any number of columns, column heading names, column order, data, and corrupt data to look for, etc. Therefore, at a minimum, this function must have input parameters defined for the following:

Input CSV file name Name of the input file Output CSV file name Name of the output file Corrupt data column name Name of the column that has the corrupt data in it Corrupt data value The specific data that your code is looking to replace Replacement value The specific data with which your code will replace the corrupt data with

If you like, you can set default values for each of these parameters that point to the specifics for this assignment. As an example, the default parameter for an input_file parameter would be unit_7_restaurant_rating.csv. In this manner, if you set defaults for each parameter of your function, you can then call your function without supplying any arguments.

REMINDER: Run your code and make sure it works as intended.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Contemporary Issues In Database Design And Information Systems Development

Authors: Keng Siau

1st Edition

1599042894, 978-1599042893

More Books

Students also viewed these Databases questions