Category: Uncategorized

Workout Wednesday – Unemployment

I wasn’t feeling the Makeover Monday dataset for week three, so I did Workout Wednesday instead! (Love Emma’s approach of Trump v handlers tho!) The original required a worksheet for each state, which sounded *NOT FUN* so instead of sticking to the original challenge I got as close as possible using a single trellis chart. 

First I used dateparse on the years, and then created calculations for state and national unemployment rates. By fixing the national rate to the year, we can get them to appear on the same chart. (Note – remember that states have different populations, so don’t use the average of the state’s averages!)

Next I replicated the chart format using a single state. The line was simply the difference between state and national rates. Then I created a calculated field for the endpoint (if last() = 0 then [measure]) and added it via synchronized dual axis. Add a T|F calculation to color and you’re good to go. There was a lot of formatting. The pink shading was done using a reference band, and I used Times New Roman to approximate the original font. The trickiest part was getting the numbers to appear in the right format. ([Measure] > Default Properties > Number Format > Custom and then enter this: “+” #,##0.0%;”-” #,##0.0%;)

Finally, I built the small multiples grid. I had done this before with the lyrics makeover so this was a snap.

It was frustrating to not be in control of the headers, spacing, and axes of the small multiples. While it’s /possible/ to tweak these elements by creating separate worksheets, it isn’t practical or scalable. This is one of the few times I’ve felt truly limited in Tableau and would have preferred working in a platform with less structure and more control.

Data Science

For the past month I’ve been working through Microsoft’s Data Science curriculum on edX. I’ve completed Dat101 (intro to Data Science) and Dat201 (Querying with Transact SQL). Next up is DS101X (Columbia’s Statistical Thinking for Data Science and Analytics).  

So far the content has been great. The SQL course was surprisingly thorough. The Excel section of the intro course was mostly review, but even it had a few new things!  The courses are completely free, though you can give them money for an official certificate.

Python vs Java

I recently completed the JavaScript and Java courses on Codecademy*. (Tableau has a JavaScript API that can be harnessed to create really cool stuff.) But, as soon as I figured out Java, I needed to brush up on Python for an upcoming Data Science course.

Transitioning between the two is notoriously tricky. I found myself adding so many unnecessary characters that I decided to build a table to look at them side by side.

 

Python Java
Comment # //
Multiline Comment “”” /*
Boolean True true
Character n/a ‘A’
String “A” or ‘A’ “A”
x = 1

x = “A”

Legal illegal
Concatenation x = 3

s = “The answer is ” + str(x)

int x = 3

String s = “The answer is ” +  x;

Functions def square(x):

return x*x

public static int square(int x){

return x*x

}

If if x > 0:

  print ‘positive’

elif x < 0:

  print ‘negative’

else:

  print ‘zero’

if (x > 0) {

   System.out.println(“positive”);

} else if (x < 0) {

System.out.println(“negative”);

} else {

System.out.println(“zero”);

}

Boolean Operators and or not &&, ||, !
Loops for w in words:

   w = w.upper()

   print w

for i in range(2, 9, 3):

   print i

for (String w: words) {

   w = w.toUppercase();

   System.out.println(w);

}

for (int i = 2; i < 9; i +=3)

   System.out.println(i);

Dictionaries map = dict()

map[‘Jose’] = ‘773-000-1234’ map[‘Mary’] = ‘312-555-9999’

print map[‘Jose’]  

for key in map:

   print key

   print map[key]

Map<String, String> map = new HashMap<String, String>();

map.put(“Jose”, “773-000-1234”);

map.put(“Mary”, “312-555-9999”);

System.out.println(map.get(‘Jose’));

for (String key : map.keySet()) {

    System.out.println(key);

    System.out.println(map.get(key));

}

From <http://anh.cs.luc.edu/331/notes/JavaVsPython.html>

*The new Learn ___ courses seem crappy. The projects are behind a paywall, and the exercises seem much, much easier than legacy ones.

Hello World!

This blog exists to show off my non-confidential work, and to share the resources and tips that I use. Expect to see a lot of data analysis and visualization using Tableau and Excel, along with an occasional programming lesson or puzzle.

Thanks for visiting
-GH