Question: USING PYTHON Using this data, write a python code to answer the following questions: 1. What is the most popular boy name in 2010? This
USING PYTHON
Using this data, write a python code to answer the following questions:
1. What is the most popular boy name in 2010? This function should return a tuple of type string and integer.
2. List all the girl names which number is greater than 10000? This function should return a list of string.
3. Count the occurances of all the boy's names whose number is greater than 8000? This function should return an integer.
4. Given a name and gender, what is the number of it? This function should return an integer.
# Data: National Data on the relative frequency of given names in the population of U.S. births where the individual has a Social Security Number. # yob2010.csv is the record of 2010. It has the format "Name, Gender, Number", where name is 2 to 15 characters, gender is M (male) or F (female), and "Number" is the number of occurences of the name # Run this cell to create a list of tuples called baby-list. # The three elements of each tuple is in the format of (name, gender, number) # Both name and gender are of type string and number is of type integer # ! ! ! Don't modify this cell !! ! import pandas as pd df pd.read_csv ('yob2010.csv', header-e) name_list -list(df.Name) gender list - list(df.Gender) list(df.Number) number_list - list (map (int,list (df.Number))) baby_list - list(zip(name_list, gender_list, number_list )) baby_list Out [131]'Aaban', M, 9), 'Aadam, 'M, 7), Aadan, 'M', 11), 'Aaden, 'M, 448), Aadhav', M, 13), 'Aadhavan' 'M', 5), 'Aadhya, F, 19), ('Aadi 'M', 54), ('Aadil', '' 11)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
