Tableau for Data Science and Data Visualization - Crash Course Tutorial

freeCodeCamp.org · Beginner ·📊 Data Analytics & Business Intelligence ·7y ago

Key Takeaways

Produces interactive data visualizations using Tableau for data science and data analysis

Full Transcript

hello everyone and welcome to this tutorial on tableau for data science we're going to cover a few basic features of tableau and how i use it for data science and how it can kind of fit into your workflow here's an example of a data science workflow we have in this example six different components and this is going to be different you know depending on what type of environment you're working in but generally you're going to have the data collection data exploration through the data wrangling data munching stage where you have to pull everything together and clean it for modeling and then the next step would be modeling validation and then reporting so the way i use tableau primarily is in the exploration phase and then in the reporting phase so expiration i want to basically be able to look at the data once i collect it i want to be able to look at the different variables that exist i want to see you know how the data is um distributed for example for each variable i want to see if there's any outliers or anything like that that i want to kick out from the uh the modeling because you know if you feed bad data into this model you're going to get some you know your garbage in garbage out so being able to explore the data i find is is really helpful and sometimes that's really all you need to know if you should move forward or not you know if you're trying to look to see if there's some kind of a relationship between variables sometimes a quick exploration and tableau a nice visual will help give you that and then also in the reporting side so once you've built your model you validated it and you want to be able to share your results with others tableau is also you know ideal for that they have great reporting tools it doesn't matter really what kind of organization you're in you you can pass you know if you have tableau server or or not you can you can pass your workbooks on to others so that they can view them as well so what is tableau so we kind of covered it briefly in the last slide but it's just a business intelligence slash data visualization tool that allows you to make sense of your data really by by looking at it right i mean sometimes we're we're looking at millions of rows of data you could check maybe the first hundred or you know first few thousand and look at the data but that's really not efficient and it's really not it's really not feasible these days to be able to just look at the data and figure out what's going on with big data and there's millions tens of millions of rows billions of rows potentially and being able to throw this stuff quickly into a tool like tableau and look at it really really helps a lot so here you have tableau desktop and then the server version so that we're going to be using the desktop version today specifically tableau public which is free you can download it for free from their website and that's just the software that you download to your computer and then the server version actually is within the browser you can create charts and dashboards and then upload that to the server for consumption throughout your organization so the interface here for tableau desktop is is really just drag and drop it reminds me of a pivot table in excel so you drag you know the columns and rows around to get what you want and and the way that this works is these are the fields here um and it's broken down into dimensions and measures so a dimension i think of a dimension as basically a category or a categorical variable and then a measure is a numerical value so it could be the number of records it could be any number of things and then here you have a filter you can apply a filter here and i'll show you how to use this section later the filter in the mark section but moving over here here's where you placed your columns and rows so if i want to basically show in column form i want to be able to let's just say pull in current status here to the columns and then number of records to the row then it would give me the current status categories along the x-axis and then the volumes for that category along the y-axis here so we're going to go over this with the live demo here but just want to give you a brief introduction to the interface and and how it's set up and this is the end result you know once you're able to make a few charts you could pull it together and make a dashboard like this for example so now we're going to go ahead and download tableau public i've just googled tableau public here and you're gonna have to put in your your email address here to download the app go ahead and put mine in there and download it may take a while depending on your internet speed but it's generally pretty quick so go ahead and install that on your computer i'm going to fast forward the video here so that you don't have to watch this entire install but feel free to pause the video and hit play again when you're ready to go okay so now i've downloaded tableau public i have the shortcut here was installed on my desktop and here we needed to connect to a file so it gives you several options here excel text json access pdf spatial or statistical file and the difference between the tableau public version and the tableau desktop which is the paid version it's about 850 dollars is that you're you're limited to just a handful of inputs here hand just a handful of file types um the desktop version really has has more options here and you can you know you can connect to a server like um azure or any sort of cloud environment so aws azure or google cloud and pull your data in directly from there here so we need to go ahead and get our data set and the data set i'm going to use for this tutorial is the titanic data set from kaggle and i'll include links to tableau public and this data set in the video description you'll just click on that and you'll probably have to sign up if you don't have a kaggle account already and basically what this is is kaggle is is essentially just sort of the online olympics for data nerds you you have competitions for machine learning deep learning models companies can actually post their their data sets on kaggle and have basically the best data scientists in the world compete to build the best model and the winner can actually earn money so it's pretty cool so we're gonna go ahead and i've already got an account so i'm gonna sign in here and once you're logged in you can go to the data tab here and then we're gonna actually use train dot csv let's go ahead and download that i'm just going to go ahead and move that to my desktop and now we're going to connect to that csv file so it looks like an excel file but it's really a flat csv file test one so we're going to use text file input here navigate to the desktop pull that in and once you open tableau public and import your data set it's basically just going to show you all of the data fields that exist and you may not know what those what those are so passenger id survived passenger class name example for example so kaggle actually has a data dictionary here on the data set page so survival is a categorical variable one standing for yes two meaning know that they didn't survive passenger class is the ticket class so first second third class sex is the gender male or female age in years number of siblings parents children above the titanic for the following variables and then ticket picket number fair cabin number so the cabin number could be indicative of where they were located on the ship and then embarked as their report of embarkation so just just looking at this data dictionary you can kind of get a feel for which variables might be useful and which variables may not be useful at all so survival obviously is is very important we want to look at the correlation between these variables these other variables and whether or not the passenger survived so now we're going to go back to tableau passenger id that's going to be probably not very useful survive that's going to be very important passenger class passenger name is not going to be very important the ticket number is unlikely to be significant fair that's how much they paid cabin number and embarked so you can see we have all these columns here and you can always reference the data dictionary so we're going to go ahead and click on sheet 1 at the bottom and you can look how tableau automatically pulls in these different variables so they it makes a determination based on the type of data being pulled in whether it should be a dimension or a measure so in this class i'm sorry in this example we're going to really just want to look at the number of records and how the number of records relate to these different categories and whether the passenger survives we're going to actually go ahead and make all of these a dimension so for age to become a dimension we may put that into different bins so if i want to do that automatically for example if i want to choose an age let me range ahead and give an example here if i want to show this going down you can see here that it's it's just a measure here so it's adding up all the ages but what i really want to see is you know is there sort of a correlation between the age and whether or not the person survives so we actually want to create a measure based on this age measure create a dimension i'm sorry based on this age measure and we can do that automatically by creating bins so we can call it age bin and the size of the bin is basically the number of years between each bucket we'll just do 10 years and if we pull that in there you see we have a null value we'll go ahead and pull in the number of records and then circle back to that null so here we go now we have a distribution of all passengers on the titanic we're going to go ahead and pull out the null here it's very important to note that when i pull this over i'm not just clicking on it and pulling it over i'm hitting on a pc control on a mac you would use the command button and then left click at the same time and pulling this field over to the filters bar and if i uncheck the null value there apply and then okay that gives me the distribution without the null values so this is great but you know i want to have some context here by adding percentages so if i take number of records here again and pull it up to the rows bar and then hit this down arrow here and you basically have this drop down and then quick table calculation and then percent of total okay so now what that did is add we have the volumes here above and then the percent of total below but i really don't have any labels so i need to add the labels here so this makes sense in the marks bar this basically allows you to change the coloring the labels the size of your chart and you have three in this example you have three sections you have all the section which is the summation of all the records and then this bottom one represents the basically the percent of total so for the second one we want to go ahead and pull in the labels here to add the labels the column labels to each each bar so i'm going to hit control on my pc command on a mac and then left click hold those together and then drag it over to the labels box and you can see that it adds the labels there we're going to do the same thing now but for the bottom section and the percent of total control left click hold and then move it down to the label section you can see now on top we have the volumes and then the percentage of the total number of records below so this is great but what it really doesn't give us is whether you know we want to know if age was an influencing variable on whether or not the passenger survived so we're going to use the survived variable here and it's a measure tabloid treated that as a measure when it pulled it in to the data set but we really want to treat that as a categorical variable so we want to convert it from a measure to a dimension and the way you do that is you hover over the the variable and click down here and then convert to dimension so now that's a dimension it moves up to from measures up to the to the dimension section and we want to color these bars based on whether the passenger survives or not so i'm going to hold down control and then left click on my pc command left click on the mac in order to drag this field over but i want to do i want to apply that color to both sections so i'm going to click on the all marks box here and then click on it control left click hold and then drag that over to color and then you can see this legend pops up over here on the right and what that represents is if it's orange then that represents a survivor the survivor portion of the population and blue is the non-survivor population so you can see what the distribution looks like here in terms of the total number of records by age bin and then you can compare you know each ratio the percentage each age bucket to see if that age grouping had a disproportionate survival rate relative to all the passengers so this is great we're going to call this i'm going to rename this tab so i just double clicked here on the sheet and we'll call it age okay and now the good part is that we've already built this out so we don't have to redo this for every variable so i'm going to right click here and then duplicate and so what i'm going to do now is just swap out age for another variable so in this case we're going to use passenger class so i want to get rid of age bin so what i did to get rid of that is i just clicked on it left clicked no control or command button just and then just dragged it below and that got you know that removed it from the filter and i can do the same thing here just drag it away and here we're just stuck with you know left with these the summations of each each category here so now i want to add passenger class this also was treated as a measure so we want to convert that to a dimension drag that over we only have three classes here i can drag this over this chart to expand it so that it makes more sense we do not have any null values here which is great and you can see that it automatically populates everything so that's that's great we can change the name here to p class to represent passenger class duplicate that and appearance of children let's look at that number of parents children aboard the titanic number of sibling spouses aboard the titanic we're going to look at sibling spouses we'll convert that to a dimension swap that out there we go rename this sibling spouse and i'm going to create one more chart one more sheet and it's basically going to be whether or not they survive just to get a feel for you know out of all the passengers how many survived so i'm going to pull over the survived variable here and then number of records and this does not look very nice right so we can actually change the chart type over here if you click on show me over here in the top right corner i'm going to actually just create a pie chart i feel like that makes a lot of sense for this type of information you know it's going to be one or the other they survived or they didn't survive and i can drag that out to make a little bit bigger and when you click on the pie chart option here it automatically adds these labels and what i can do in order to add the labels to the visual itself is control left click and drag that up to the label command left click if you're on a mac and then i can add okay so that worked now i want to add survived the one and the zero so one represents a survivor zero represents a non-survivor we'll name that sheet survived okay so now we have four sheets we have age passenger class sibling spouse and survived and that's great we can actually use this information to create a dashboard in tableau and i'm going to get that to that in a second but what i want to cover very quickly is how to create your own measure okay so i'm going to use age for this i'm going to instead of using the bins create a calculated field we'll call it custom age bins we're going to say if age is less than or equal to 10 then 0 to 10. else if age greater than 10. and age less than or equal to let's just say 20 then 11 to 20. else if you get the idea i'm not going to do this for every age bucket um we'll just lump everybody else in over over 20. um we'll just put them in 20 plus so they're 20 years plus and then if i add the end there i've got lsif and an else so i'm going to go ahead and remove elsif and then i have an else which will be the catch-all at the end if it doesn't fall within one of these buckets and then the end of the statement apply and now i'm going to duplicate the age tab for this example and swap out age bin for my custom age group custom age bin so now you can see it's 0 through 10 11 through 20 20 plus and you know we can use the bin function to do that really quickly i think the point of that exercise was to show you how to create a calculated field so i really don't need that anymore so i'm going to delete it so now we want to take these sheets that we've created and we want to make a dashboard okay so to do that you can see these three tabs here below with the little chart there and then the four boxes and then what's called a story we want to click on the the dashboard by the new dashboard button okay so what this does is creates a blank canvas for us to create a dashboard and this thing always for whatever reason the size is always wrong so i just change it click on this little down arrow here and then the other one right below it and choose automatic and it expands it to fit your screen and then we just double click each of these sheets so age class sibling survived okay that was really fast really easy to kind of pull this stuff together and add it to a dashboard and i don't like this number of records thing every i can click on it and check you know hit the x and it will remove it and let's say i want to have survived up here in the top section i can move i can move that around you can drag and drop these sections to fit your needs there we go let's say i want to expand this some you can actually just hover your mouse out a little ways and drag that so that it stands out a little bit more and you can change the colors here so i can change the survived or non-survived i'm going to change that to green to record you know i'm sorry change the one to green to represent that they survived and then the zeroed to red i could do that here and it will change all of them there you go some nice christmas colors but we can drag this over as well to make it fit more symmetrical and then increase the size of this as well and reposition it so we just in a matter of minutes we're able to create sheets and then a dashboard and yeah that's really fantastic i don't all these other tools that you could use like click or d3 or i i don't know it takes a while it's it you got to know how to code in those software programs in order to make the visualizations and it you know it's just a pain so the thing i like about tableau is it's it's really easy i compare it to to like an iphone where p someone a child can basically pick up an iphone and immediately start using it it's that intuitive you know tableau is that way for visualization it's really that simple you just literally drag and drop until you get what you want so i really actually don't like these colors especially the red maybe we'll just add the blue back okay that's a little bit better but anyway we only dealt with a few of these variables here you can get a feel for you know how many people survived you know it looks like and we we could actually add the percentages here as well um but it looks like you know most people did not survive so it's really sad um and you can look at at this chart here and say you know out of the people that did survive it looks like you know if they were between the ages of 20 and 30 you had a better success rate there and for the passenger classes it looks like if you were you know in the first class you had a better shot you know 15 percent versus you know less than 10 percent here and then 13 here and siblings and spouses those that had um i guess fewer siblings and spouses they they survived at a higher rate which is um obviously pretty sad but this this really kind of brings to life the data we we all know what happened with the titanic and if we were to just look at this data here in the data source you know just looking at this you know there's only 891 rows you might be able to even look at this and sort of pick up some trends but what if that number was 8 million rows right there's no way you could could go through that data and honestly there's no way you could get this data into excel i know they have excel's gotten better but just the expedience with which you can pull data in and look at it i i'm not sure that you could do that with any other software that's available and then quickly create these sheets and dashboards so and thanks for watching [Music]

Original Description

Learn to use Tableau to produce high quality, interactive data visualizations! Tableau can help you see and understand your data. Connect to almost any database, drag and drop to create visualizations, and share with a click. 🔗Tableau Public: https://public.tableau.com/en-us/s/ 🔗Kaggle dataset: https://www.kaggle.com/c/titanic/data Find more data science information: https://www.velocityanalytics.io/ Tutorial from Velocity Consulting. Check out their YouTube channel: https://www.youtube.com/channel/UCjWUocSV-slQnC64nQ1vVhQ -- Learn to code for free and get a developer job: https://www.freecodecamp.org Read hundreds of articles on programming: https://medium.freecodecamp.org ❤️ Support for this channel comes from our friends at Scrimba – the coding platform that's reinvented interactive learning: https://scrimba.com/freecodecamp
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from freeCodeCamp.org · freeCodeCamp.org · 0 of 60

← Previous Next →
1 React: Production Server Setup Part 2 - Live Coding with Jesse
React: Production Server Setup Part 2 - Live Coding with Jesse
freeCodeCamp.org
2 cookies vs localStorage vs sessionStorage - Beau teaches JavaScript
cookies vs localStorage vs sessionStorage - Beau teaches JavaScript
freeCodeCamp.org
3 Browser history tutorial - Beau teaches JavaScript
Browser history tutorial - Beau teaches JavaScript
freeCodeCamp.org
4 Graph Data Structure Intro (inc. adjacency list, adjacency matrix, incidence matrix)
Graph Data Structure Intro (inc. adjacency list, adjacency matrix, incidence matrix)
freeCodeCamp.org
5 React: Parameterized Routing with Next.js - Live Coding with Jesse
React: Parameterized Routing with Next.js - Live Coding with Jesse
freeCodeCamp.org
6 React: Dealing with jQuery Issues - Live Coding with Jesse
React: Dealing with jQuery Issues - Live Coding with Jesse
freeCodeCamp.org
7 setInterval and setTimeout: timing events - Beau teaches JavaScript
setInterval and setTimeout: timing events - Beau teaches JavaScript
freeCodeCamp.org
8 Browser and Device Testing - Live Coding with Jesse
Browser and Device Testing - Live Coding with Jesse
freeCodeCamp.org
9 Last Minute Updates - Live Coding with Jesse
Last Minute Updates - Live Coding with Jesse
freeCodeCamp.org
10 Post Launch Updates - Live Coding with Jesse
Post Launch Updates - Live Coding with Jesse
freeCodeCamp.org
11 React: Setting Up Google Analytics - Live Coding with Jesse
React: Setting Up Google Analytics - Live Coding with Jesse
freeCodeCamp.org
12 React: Masonry Layout - Live Coding with Jesse
React: Masonry Layout - Live Coding with Jesse
freeCodeCamp.org
13 Load Balancing Digital Ocean Droplets - Live Coding with Jesse
Load Balancing Digital Ocean Droplets - Live Coding with Jesse
freeCodeCamp.org
14 try, catch, finally, throw - error handling in JavaScript
try, catch, finally, throw - error handling in JavaScript
freeCodeCamp.org
15 Load Balancing: SSL Passthrough Setup - Live Coding with Jesse
Load Balancing: SSL Passthrough Setup - Live Coding with Jesse
freeCodeCamp.org
16 Graphs: breadth-first search - Beau teaches JavaScript
Graphs: breadth-first search - Beau teaches JavaScript
freeCodeCamp.org
17 React: Masonry Layout Part 2 - Live Coding with Jesse
React: Masonry Layout Part 2 - Live Coding with Jesse
freeCodeCamp.org
18 React: WordPress API Live Search - Live Coding with Jesse
React: WordPress API Live Search - Live Coding with Jesse
freeCodeCamp.org
19 Creating WordPress Custom Post Types - Live Coding With Jesse
Creating WordPress Custom Post Types - Live Coding With Jesse
freeCodeCamp.org
20 Dates - Beau teaches JavaScript
Dates - Beau teaches JavaScript
freeCodeCamp.org
21 Miscellaneous Front End Updates - Live Coding with Jesse
Miscellaneous Front End Updates - Live Coding with Jesse
freeCodeCamp.org
22 Merging a Pull Request from GitHub - Live Coding with Jesse
Merging a Pull Request from GitHub - Live Coding with Jesse
freeCodeCamp.org
23 React + Prettier + Standard JS - Live Coding with Jesse
React + Prettier + Standard JS - Live Coding with Jesse
freeCodeCamp.org
24 React: Sortable Responsive Table - Live Coding with Jesse
React: Sortable Responsive Table - Live Coding with Jesse
freeCodeCamp.org
25 Geolocation Sorting by Distance - Live Coding with Jesse
Geolocation Sorting by Distance - Live Coding with Jesse
freeCodeCamp.org
26 Tradeoff Matrix - Agile Software Development
Tradeoff Matrix - Agile Software Development
freeCodeCamp.org
27 The Definition of Ready - Agile Software Development
The Definition of Ready - Agile Software Development
freeCodeCamp.org
28 Getting first React job without experience - Ask Preethi
Getting first React job without experience - Ask Preethi
freeCodeCamp.org
29 React: Google Analytics Click Tracking - Live Coding with Jesse
React: Google Analytics Click Tracking - Live Coding with Jesse
freeCodeCamp.org
30 Submitting a PR to an Open Source Project - Live Coding with Jesse
Submitting a PR to an Open Source Project - Live Coding with Jesse
freeCodeCamp.org
31 Should I go back to school to get CS degree? - Ask Preethi
Should I go back to school to get CS degree? - Ask Preethi
freeCodeCamp.org
32 Hero Section CSS Changes - Live Coding with Jesse
Hero Section CSS Changes - Live Coding with Jesse
freeCodeCamp.org
33 Working Agreement - Agile Software Development
Working Agreement - Agile Software Development
freeCodeCamp.org
34 A day at Pennybox with Co-Founder Reji Eapen
A day at Pennybox with Co-Founder Reji Eapen
freeCodeCamp.org
35 React: Sorting and Filtering Data - Live Coding with Jesse
React: Sorting and Filtering Data - Live Coding with Jesse
freeCodeCamp.org
36 React: Sorting and Filtering Data Part 2 - Live Coding with Jesse
React: Sorting and Filtering Data Part 2 - Live Coding with Jesse
freeCodeCamp.org
37 React: Building a New UI - Live Coding with Jesse
React: Building a New UI - Live Coding with Jesse
freeCodeCamp.org
38 Definition of Done - Agile Software Development
Definition of Done - Agile Software Development
freeCodeCamp.org
39 Getting started with jQuery (tutorial) - Beau teaches JavaScript
Getting started with jQuery (tutorial) - Beau teaches JavaScript
freeCodeCamp.org
40 Making a React Blog with WordPress Content - Live Coding with Jesse
Making a React Blog with WordPress Content - Live Coding with Jesse
freeCodeCamp.org
41 React, NextJS, CSS - Live Coding with Jesse
React, NextJS, CSS - Live Coding with Jesse
freeCodeCamp.org
42 jQuery events - Beau teaches JavaScript
jQuery events - Beau teaches JavaScript
freeCodeCamp.org
43 React/NextJS Routing and WordPress API Custom Types - Live Coding with Jesse
React/NextJS Routing and WordPress API Custom Types - Live Coding with Jesse
freeCodeCamp.org
44 React: Working with API Data - Live Coding with Jesse
React: Working with API Data - Live Coding with Jesse
freeCodeCamp.org
45 React: Refactoring Components - Live Streaming with Jesse
React: Refactoring Components - Live Streaming with Jesse
freeCodeCamp.org
46 jQuery effects - Beau teaches JavaScript
jQuery effects - Beau teaches JavaScript
freeCodeCamp.org
47 More React Refactoring - Live Coding with Jesse
More React Refactoring - Live Coding with Jesse
freeCodeCamp.org
48 animate in jQuery - Beau teaches JavaScript
animate in jQuery - Beau teaches JavaScript
freeCodeCamp.org
49 "Finishing" My React Site - Live Coding with Jesse
"Finishing" My React Site - Live Coding with Jesse
freeCodeCamp.org
50 Starting a New React Project (P2D1) - Live Coding with Jesse
Starting a New React Project (P2D1) - Live Coding with Jesse
freeCodeCamp.org
51 React Project 2 Day 2: Learning Material UI - Live Coding with Jesse
React Project 2 Day 2: Learning Material UI - Live Coding with Jesse
freeCodeCamp.org
52 The Agile Manifesto - Agile Software Development
The Agile Manifesto - Agile Software Development
freeCodeCamp.org
53 jQuery: get and set with http, text, val, and attr - Beau teaches JavaScript
jQuery: get and set with http, text, val, and attr - Beau teaches JavaScript
freeCodeCamp.org
54 React Project 2 Day 3 - Live Coding with Jesse
React Project 2 Day 3 - Live Coding with Jesse
freeCodeCamp.org
55 The INVEST approach to product backlog items
The INVEST approach to product backlog items
freeCodeCamp.org
56 React Project 2 Day 4 - Live Coding with Jesse
React Project 2 Day 4 - Live Coding with Jesse
freeCodeCamp.org
57 Chickens and Pigs - Agile Software Development
Chickens and Pigs - Agile Software Development
freeCodeCamp.org
58 React Project 2 Day 5 - Live Coding with Jesse
React Project 2 Day 5 - Live Coding with Jesse
freeCodeCamp.org
59 jQuery: add and remove DOM elements - Beau teaches JavaScript
jQuery: add and remove DOM elements - Beau teaches JavaScript
freeCodeCamp.org
60 React Project 2 Day 6 - Live Coding with Jesse
React Project 2 Day 6 - Live Coding with Jesse
freeCodeCamp.org

Related Reads

Up next
Salesforce Tableau CRM & Einstein Discovery Consultant Exam: Full Syllabus Breakdown (New 2025 Bluep
Emily Unfiltered
Watch →