Please provide the python code along with the resulting output. def csv_cleaner(input_file): ''' Question - Read michelin.csv
Question:
Please provide the python code along with the resulting output.
def csv_cleaner(input_file): ''' Question - Read michelin.csv with CSV module and return a list of lists containing each cleaned row. - Make sure to include the headers - There are 3 issues with the csv that must be fixed: 1. Combine the last 2 columns to make one column. Rename this to be 'Cuisine Type' 2. Remove any excess white space from the new column, 'Cuisine Type', as well as the column titled 'Country' 3. Fill in all empty spaces in the 'Price' column with the average (as an integer) of the total price in an equivalent string format - 1 is equiavlent to $ - 2 is equivalent to $ - 3 is equivalent to $$ and so on - Average is equal to the total dollar signs / total number of rows - Write the list of lists to a new csv file called 'clean_michelin.csv' - Make sure to write to the new csv file before the return statement
Args: input_file(michelin.csv) Returns: Nested list
Expected Output: [['', 'Unnamed: 0', 'Restaurant Name', 'Number of Stars', 'City', 'Country', 'Price', 'Cuisine Type'], ... ['17', '17', 'Bottiglieria 1881', '1', 'Cracow', 'Poland', '$#x27;, 'Creative']]
'''
michelin.csv
,Unnamed: 0,Restaurant Name,Number of Stars,City,Country,Price,Cuisine_type_1,Cuisine_type_1.1 0,0,essncia,1,Budapest, Hungary,$$,, Modern Cuisine 1,1,Babel,1,Budapest, Hungary,$$,Modern Cuisine, 2,2,Borkonyha Winekitchen,1,Budapest, Hungary,$,Modern Cuisine, 3,3,Costes,1,Budapest, Hungary,$$,Modern Cuisine, 4,4,Stand,2,Budapest, Hungary,$$,, Modern Cuisine 5,5,Platn Gourmet,2,Tata, Hungary,$$,, Creative 6,6,Salt,1,Budapest, Hungary,$$,Modern Cuisine, 7,7,Rumour,1,Budapest, Hungary,$$,Creative, 8,8,42,1,Esztergom, Hungary,$$,Modern Cuisine, 9,9,Kissa Tanto,1,Vancouver, Canada,$$,, Fusion 10,10,Published on Main,1,Vancouver, Canada,$$,, Contemporary 11,11,Barbara,1,Vancouver, Canada,$$,, Contemporary 12,12,Masayoshi,1,Vancouver, Canada,$$,, Japanese 13,13,iDen & QuanJuDe Beijing Duck House,1,Vancouver, Canada,$$,, Chinese 14,14,Burdock & Co,1,Vancouver, Canada,$$,, Contemporary 15,15,St. Lawrence,1,Vancouver, Canada,$$,, French 16,16,AnnaLena,1,Vancouver, Canada,$$,, Contemporary 17,17,Bottiglieria 1881,1,Cracow, Poland,$$,Creative,
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill