CSV Analytics Final ProjectFor the final project, you are to create an interactive CSV analysis program in Python named csval.py according to the requirements specified in this document.Description:Create a menu-driven program that reads in a CSV file and identifies the maximum value of a user selected attribute and the corresponding object that the maximum value belongs to. This Wikipedia article describes a CSV file:https://en.wikipedia.org/wiki/Comma-separated_values During a session, the program is to prompt the user for the name of the CSV file and present a menu of the available attributes derived from the CSV file. The user will then make a selection from the attribute menu and the program will present the maximum value for the object andthe name of the object.
CSV File Format:While all CSV files do not fit this particular format, you are guaranteed that all CSV files entered by the user will match the following format. Multiple CSV files are provided for testing. They are contained in a file attached to the assignment called CSVTestFiles.zip. To examine how the data looks within the CSV file and how Python will read each line, the file can be opened with any text editor. The file can also be opened within Excel to show a tabular version of the data; note that how the data appears in Excel will not be how it appears in Python till after you create atwo-dimensional list of the data.The following is a small sample CSV file (displayed as if it was opened with a text editor):Student,Midterm,Final Project,Final ExamKelly,95,92,93Joe,84,94,92If the sample CSV file was parsed and turned into a two-dimensional list, it would appear as thefollowing:All values within the CSV file are separated by commas. Row 0 of the CSV file contains theattributes from Column 1 to the final column of the CSV file (in this example, that would-becolumn 3). Within the above sample, there would be three separate attributes (Midterm,Column 0 Column 1 Column 2 Column 3Row 0 Student Midterm Final Project Final ExamRow 1 Kelly 95 92 93Row 2 Joe 84 94 92CSV AnalyticsFinal ProjectFinal Project, Final Exam) that the user should be able to select from the menu in the program. You can think of row 0 as the column headers for the rest of the data.The rest of the rows within the CSV file, contains the objects that will be examined to identify the max value. In this example, there would be two objects (Kelly and Joe). Kelly has a grade of 95% for the midterm, 92% for the final project, and a 93% for the final exam. Joe, on the other hand, has a grade of 84% for the midterm, 94% for the final project, and a 92% for the final exam.The element in row 0, column 0 is to always be ignored since this element is the column header for the object names. In this example, Student would be the element to be ignored.The following would be the menu derived from this sample CSV file:1. Midterm2. Final Project3. Final ExamIf a user selected the Midterm attribute within our program, the program would print off:Largest Midterm value is Kelly with 95.0All elements in the CSV file that is not an object name or an attribute is a number. Each number value within the CSV file can be represented with a floating-point number. Do not use Integers since some of the values may have decimal precision or scientific notation (e.g. 1.0E+11).Converting a string to a floating-point number handles these inconsistencies for you.Requirements:The program is to prompt the user for the name of the CSV file. If an exception occurs trying to open or read the file, an error message is to be displayed. The program is not to crash if the file is not found or there is an error reading the file. Use try- except!Read the CSV file and create a two-dimensional list with the contents of the file. Each line of thefile should be split upon the comma (e.g. ,).Display a menu from the available attributes from the CSV file and prompt the user to make a selection from the menu by entering the number of their choice. If the user enters something other than a number or a number in the range of the choices provided in the menu they are to be given feedback that their choice is not valid and asked for the input again. Under no circumstance should input from the user crash the program.The output from the program is to display the selected attribute, the maximum value from that attribute and the objects name that the maximum value belongs to.
After the output is displayed to the user, the program should ask the user if they would like to analyze another attribute. Use the prompt: Would you like to conduct another analysis on an attribute? (y/n) If the user answers y, then the program is to present the attribute menu again and accept input for another attribute. If the user answers with anything other than y, the program is to ask the user if they would like to evaluate another CSV file. Use the prompt: Would you like to evaluate another file? (y/n) If the user answers y, then the program is to accept input for another file name. If the user answers with anything other than y, the program is to exit.The number of attributes displayed in the menu should NOT be hardcoded but be derived from the CSV file. If the CSV file has 2 attributes, the attribute menu should show 2 attributes to choose from; but if the CSV file has 15 attributes, the attribute menu should show 15 attributes to choose from.Sample Output:All CSV files are attached to this assignment.(user input is highlighted in orange)Sample output 1:Welcome to CSV Analytics!Enter the name of the file you would like to process: grades.csvAttributes:1. Midterm2. Final Project3. Final Exam4. ParticipationEnter choice: 1Largest Midterm value is Kelly with 95.0Would you like to conduct another analysis on an attribute? (y/n) yAttributes:1. Midterm2. Final Project3. Final Exam4. ParticipationEnter choice: 2Largest Final Project value is Joe with 94.0Would you like to conduct another analysis on an attribute? (y/n) nWould you like to evaluate another file? (y/n) nCSV AnalyticsFinal ProjectSample output 2:Welcome to CSV Analytics!Enter the name of the file you would like to process: miniCountries.csvAttributes:1. Area2. GDP3. PopulationEnter choice: 1Largest Area value is United States with 9631418.0Would you like to conduct another analysis on an attribute? (y/n) nWould you like to evaluate another file? (y/n) yEnter the name of the file you would like to process: grades.csvAttributes:1. Midterm2. Final Project3. Final Exam4. ParticipationEnter choice: 3Largest Final Exam value is Kelly with 93.0Would you like to conduct another analysis on an attribute? (y/n) nWould you like to evaluate another file? (y/n) nReferences:Review chapter 6 of the textbook to review how to read from a file. A CSV file can be readexactly the same as a TXT file.Review chapter 8.3 of the textbook to review how to manipulate and split strings based on acharacter.Review chapter 7.8 of the textbook to review two-dimensional lists.Review the Two-Dimensional Lists and Advanced List Operations.pdf file to review twodimensionallists and how to work with them.CSV AnalyticsFinal ProjectTesting:Once you have written your program you need to test it thoroughly. Three sample CSV filesmatching the discussed format are provided for testing (grades.csv, miniCountries.csv,countries.csv). These files are contained in a file attached to the assignment calledCSVTestFiles.zip. You must unzip the file to get the folder containing the files. You can also handcreate files that match the discussed format.
Reviews
There are no reviews yet.