Given baby names by year of birth, plot the frequency of a specific name by year.
Thanks to the U.S. Social Security Administration for providing this dataset of baby names from 1910 to 2016.
# Click the Blue Plane to transform this into a CrossCompute Tool name_table_path = 'Datasets/names-by-year.csv' name = 'louisa' target_folder = '/tmp'
from pandas import read_csv name_table = read_csv(name_table_path) name_table[:5]
name = name.capitalize().split() name
selected_name_table = name_table[name_table.name == name] selected_count_by_year = selected_name_table.groupby('year')['count'].sum() selected_count_by_year[:5]
%matplotlib inline axes = selected_count_by_year.plot(legend=False, title='Name Frequency by Year of Birth: ' + name)
from os.path import join target_path = join(target_folder, 'name-by-year.png') axes.get_figure().savefig(target_path); print('name_by_year_image_path = ' + target_path)