Question
PYTHON Popular baby names in the US. Write a python program (called q1.py) that will process data compiled by the Social Security Administration, containing all
The data comprises years from 1879 to 2017 and all 50 states and District of Columbia. The file is named names-state2017(1).csv. Each line in the file has the following format: i) the 2 digit state code (ex: CO or NY), ii) gender, iii) year of birth, iv) baby name, v) number of occurrences of the name for that year.
The program will prompt the user for one of the options:
Search by year/location:
Search by name/year/location:
Quit
The year/location will ask the user to enter a beginning and ending year, or just a specific year. Then the program will ask if the user wants to search a specific state. If the user leaves the option blank (presses enter), the program will search all states. The program should output the 5 most frequent baby names (regardless of gender), the 5 most frequent girl names, and the 5 most frequent boy names. An example is shown below:
The data from this search should be saved in a text file with the following format: first line should bring the years, line 2 the state or US if the user didn't choose a state, the next five lines will have names and number of occurrences of the name regardless of gender, the next five lines will have names and number of occurrences of the name for boys, the next five lines will have names and number of occurrences of the name for girls. For instance, from the previous example, the output file should be:
The search by name/year/location will ask the user to enter a name, a beginning and ending year, then will ask if the user wants to search a specific state. If the user leaves the option blank (presses enter), the program will search in all states. The program will show the position of that name in the ranking.
The file names-state(1).csv can be downloaded here if necessary: https://megashare.megahd.com.br/il
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started