Data School Week 2

by Laura Peterson

Week 2

Week 2 at Data School I got my first taste of Alteryx, an incredibly powerful data preparation tool. It’s truly amazing how much you can do with the software; there are so many tools to choose from!

Project

Our main focus this week was learning how to download data from an API and then parse and transform the JSON data into something Tableau friendly. I was assigned the New York Times Most Popular Articles API. I was keen to find out how much Trump is dominating our news. However, before I could do any analysis in Tableau, I had to use Alteryx to download and transform the API data. The data from the API comes in JSON form and before any manipulation looks like pages and pages of this:

NYT JSON

Alteryx

As you can see, this is not particularly useful. I quickly moved into Alteryx to start creating the workflow.NYT Alteryx Workflow

  1. Import: Imported an Excel file that contains a list of all the different NYT sections.
  2. Formula: The Formula tool contains the URL for my API. The URL only looks at one section at a time. Therefore, I used the [Section] field from my Excel import to make sure data was downloaded for all sections.
  3. Download: This tool downloaded all the data from the API into Alteryx in JSON form.
  4. Select: Selected only the fields that contain data from my API and discarded the rest.
  5. JSON Parse: This tool configured the downloaded data and output values into a single string field called [JSON Name].
  6. Text to Columns: Split the field [JSON Name] into three separate columns.
  7. Filter: Filtered out rows that don’t contain results.
  8. Select: Selected only the columns that I want in my final dataset.
  9. Auto Field: Automatically changed the field type of strings to a date, number or whatever the relevant field type should be.
  10. Export: Created a Tableau Data Extract (.tde) with all my data. 

Tableau

Now, all my data was in Tableau and it was easy to see what portion of the top articles in each section is Trump-related.

 

 

Avatar

Laura Peterson

Sun 21 May 2017

Tue 16 May 2017