Summary
This series of practice exercises is meant to give you a better understanding of the fundamental tools and features of the Savant workflow:
Upload data files
Use the Transform tool to clean and parse datasets
Use the Time Series tool to work with temporal data
Use the Filter tool to refine datasets
Export to destinations and schedule bots
To start, access and download a .csv of the practice exercise data here.
IMPORTANT NOTE: There are three Baby Names exercises in the series. If you haven't completed both Exercise #1 and Exercise #2, we recommend starting there.
Exercise #3: Find the Top 40 Baby Names with the Greatest Swing Between their Low and High Year as a Percentage of Total Names by Sex
In this third practice exercise, you will take a dataset which tracks the number of babies born with a certain first name each year:
Year | State | State Abbr | Sex | Name | # Babies Named |
1980 | California | CA | M | Bo | 25 |
1980 | Texas | TX | M | Bo | 26 |
1981 | Texas | TX | M | Bo | 22 |
1986 | Texas | TX | M | Bo | 20 |
1989 | California | CA | M | Bo | 20 |
1990 | California | CA | M | Bo | 27 |
1991 | Texas | TX | M | Bo | 26 |
And then transform it into an output that shows the top 40 baby names ranked by the greatest swing between their lowest and highest year as a percentage of the total babies named by sex, along with their biggest year and the % within that year:
Name | Sex | Biggest Year | % of Year | Swing Rank |
Jennifer | F | 1980 | 0.0209675 | 1 |
Jessica | F | 1987 | 0.0192928 | 2 |
Michael | M | 1980 | 0.0246758 | 3 |
Ashley | F | 1987 | 0.0188994 | 4 |
Christopher | M | 1984 | 0.0211675 | 5 |
Jason | M | 1980 | 0.0173008 | 6 |
Amanda | F | 1987 | 0.0143972 | 7 |
Brittany | F | 1989 | 0.0122644 | 8 |
Matthew | M | 1983 | 0.0178428 | 9 |
Melissa | F | 1980 | 0.0113635 | 10 |
* * *
NOTE: Steps 1 & 2 are identical to Exercise #1, except for the analysis naming convention.
Step 1: Open a New Analysis
Log into Savant, navigate to the Analyses tab, and click “New Analysis”.
Give your new analysis the name “Top 40 Baby Names with Greatest Swing by Decade - (Your Name)” by clicking the edit pencil next to the temporary name in the top bar:
Step 2: Add a Dataset
If you have already downloaded the data in a previous exercise, add it to the canvas. If you haven't downloaded a .csv yet, download the data here.
In your Analysis canvas, navigate to the “Add Dataset” button on the left nav bar:
Select “Upload”.
Click the grey box to open your file explorer and select the .csv file you downloaded.
Click “Next” and then “Next” again.
Name the file and hit "Confirm".
Now you should see the dataset you just connected as the first step on your canvas.
Step 3: Analyze the Data
In your Analysis canvas, navigate to the “Add Step” button on the left navigation bar:
Select “Transform” and you will see the Transform step connected to your canvas.
Double-click the “Transform” step to see a table view.
Start by converting the Year to a date value
Next, we need to hide the Year value from the table. Navigate to the left side panel, click the eye icon next to the Year value, and click "Apply":
Use the Time Series tool to get the count of babies named a certain name by year.
Next we’ll want to use a series of custom calculated fields to determine the swing in relative popularity for baby names by year. Navigate to the canvas tab, and add another “Transform” step to your canvas by clicking the "Add Step" button and selecting "Transform" as you did at the beginning of Step 3. Double-click the “Transform” step to see a table view.
First, rename the "Period Name" column to "Year".
Hide the "Period Offset" column.
Add another column to your table and rename the column to “Total Babies in Year”. Select “Builder” below the name text box and enter the following configuration:
This will give the total babies named partitioned by year, so the sum value should appear the same in every row with the same year value.
Next, add another column to your table, name the column to "% of Year". Select "Expression," enter the following configuration, and click "Confirm":
This will return the percentage of the total babies within a year that a given baby name constitutes.
Add another column to your table, rename the column to "Min %". Edit the column, select "Builder," and enter the following configuration:
This will return the minimum value from the "% of Year" column for a given name and sex across all years.
Next, add another column to your table, rename the column to "Max %". Edit the column, select "Builder," and enter the following configuration:
This will return the maximum value from the "% of Year" column for a given name and sex across all years.
Add another column to your table, rename the column to "Swing". Edit the column, select "Expression," and enter the following configuration:
This will return the difference between the Max % and Min % for a given name and sex.
Lastly, add another column to your table, rename the column to "Swing Rank". Edit the column, select "Builder," and enter the following configuration:
This will return the rank of each name and sex according to their swing in descending order, i.e., the name and sex combination with the greatest swing will be ranked #1.
Now, we need to filter the table so only rows with a name's maximum year remain. Returning to the analysis canvas, navigate to the side menu, click "Add Step" and then select the "Filter" icon:
Next, we need to filter the table down to the top 40 values. To do this, let's follow the same sequence as in the previous step and add a Filter to the canvas. Open the new Filter node, select "Builder", and edit the configuration panel to set "Swing Rank Less Than Or Equal To 40", then click "Apply":
We have one final Transform step to clean the data and prepare it for the destination. From the canvas, add an Transform step. Click into the Transform tool to make the following changes.
Rename the "Year" field to "Biggest Year", since it now only includes the Year that a name and sex combination had its greatest % of the year's total.
Toggles the settings as follows to show only the desired fields:
(Note: You can change the order of the columns with the grid icon)
The final table should look as follows:
Step 4: Configure a Destination
At this stage, your analysis is complete. The last thing you want to do is add a destination. Go back to your canvas by clicking the “Canvas” tab on the top of your table.
Click the “Add Destination” icon from the left nav bar:
Select “Add System”.
Select “Google Sheets”.
Click “Next”.
Create a blank Google sheet, name it "Baby Names Practice Exercise #3" and copy the URL into the Spreadsheet ID. Then click "Authenticate with Google".
You’ll now be required to authenticate via Google. Click your email address associated with the Google Sheet.
Click “Continue”.
Give your spreadsheet a name.
Click "Confirm".
Confirm that the Google Sheet has been connected to the last edit step on your canvas.
Click the Google Sheet Destination step on your canvas, and then click the left arrow on the right hand side to display the configuration.
Enter the following configuration, which instructs the bot to create a tab called "Baby Names Practice Exercise #3" and replace its contents starting from cell A1:
Hit "Apply".
Step 5: Run the Analysis
Finally, you can run your analysis. Do this by selecting “Run Bot” at the top of the screen. Then select “Run Now”.
You can view the progress of your run by clicking on the “Runs” tab at the top nav bar.
Once the run is complete, you should see the data output to your Google Sheet.
Congrats! You just finished the Baby Names Practice Exercise #3. You completed the series!