Data Types and Structures
Transcript
HALLIE: Picture this. You're working on a project. You've asked all the right questions, applied structured thinking, and you're completely in sync with your stakeholders. You're off to a great start. But there's another step in the process, preparing the data correctly. This is where understanding the different types of data and data structures comes in. Knowing this lets you figure out what type of data is right for the question you're answering, plus you'll gain practical skills about how to extract, use, organize, and protect your data. Hey. My name is Hallie. And I'm an analytical lead at Google. I work with companies in the health care industry. I'm so excited to welcome you to this course. You've been building up your data analyst skills in lots of different ways so far. You've learned how to ask the right questions, define the problem, and present your analysis in a way that matches up with the needs of your stakeholders.
In other words, you've learned how to tell a story using data. Now we'll learn more about the data that you'll need to tell the best story possible. But before we do that, I'd love to tell you my story. I use analytics to help health care companies develop digital marketing solutions that make their business and their brands stronger. My team and I find business and media opportunities based on the latest industry and data insights. I've been working in health care for about five years. And it's great. I really enjoy being able to use data to help spark change in such an important industry. As you'll discover in this course, data can be the main character in a very powerful story. I absolutely love using analysis to tell that story in a way that's compelling and informative. Here's a real-life example of how I've used data to tell a story. In my job, we analyze Medicare enrollment data over time and make connections to how people research Medicare plans on Google.
As people 65 and older become more informed decision makers for their health, I use the data to learn if there's an increase in Medicare enrollments and what part Google searches play if there is an increase in demand. Now it's very important that I make sure the data is relevant and valid. I also have to pay attention to questions around access and equity, while maintaining the privacy of those conducting searches. The happy ending of my story is that the data in my findings is useful to medical professionals and their patients. There's so much useful data out there. And you're building the skills you'll need to find and use the right data in the best way. In this course, you'll continue sharpening those skills. So you've already heard a lot about the data analysis process steps-- ask, prepare, process, analyze, share, and act. Now it's time to learn how to prepare the data. You'll learn to identify how data is generated and collected.
And you'll explore different formats, types, and structures of data. We'll make sure you know how to choose and use data that will help you understand and respond to a business problem. And because not all data fits each need, you'll learn how to analyze data for bias and credibility. We'll also explore what clean data means. But wait, there's more. You'll also get up close and personal with databases. We'll cover what they are and how analysts use them. You'll even get to extract your own data from a database using a couple of tools that you're already familiar with-- spreadsheets and SQL. The key here is patience. Like anything worth doing, this will take time and practice. And I'll be with you every step of the way. Still with me? Great. The last few things we'll cover are the basics of data organization and the process of protecting your data. Data works best when it's organized. And if you're organizing your data,
you'll want to protect it too. I'll show you how to do both and apply it to your own analysis. I'm so excited to help you write your own personal story as you continue exploring the world of data analytics. So let's do it. [MUSIC PLAYING] Right now data is being generated all around the world. And we're talking tons of data. Every minute of every day, millions of texts and hundreds of millions of emails are sent. On top of that, millions of online searches are made and videos viewed. And those numbers are only growing. That's a lot of data. So let's learn more about how it's made and used. In this video, we'll talk about the ways that data can be generated and how industries collect data themselves.
Every piece of information is data. And all that data is usually generated as a result of our activity in the world. These days, we spend a lot of time online. With social media and mobile devices, millions and millions of people are adding to the huge amount of data out there each and every day. Think about it like this. Every digital photo online is one piece of data. And every photo itself holds even more data, from the number of pixels to the colors contained in each of those pixels. But that's not the only way data is made. We can also generate data by collecting information. This kind of data generation and collection comes with a few more things to think about. It needs to be done with consideration to ethics, so that we maintain people's rights and privacy. We'll learn more about that later on. For now, let's check out a real-world example. The United States Census Bureau uses forms to collect data about the country's population.
This data is used for a number of reasons, like funding for schools, hospitals, and fire departments. The Bureau also collects information about things like US businesses, creating their own data in the process. The great thing about this is that others can then use the data for their own needs, including analysis. The annual business survey is used to figure out the needs of businesses and how to provide them with resources to help them succeed. I actually generate data in the analytics I do for the health care industry. We run a lot of surveys to learn how patients feel about certain things related to their health care. For example, one survey asked how patients feel about telemedicine versus in-person doctor visits. The data we collected help the companies we work with improve the care that their patients receive. Survey data is just one example. There's all kinds of data being generated all the time. And there's lots of different ways to collect it.
Even something as simple as an interview can help someone collect data. Imagine you're in a job interview. To impress the hiring manager, you'll want to share information about yourself. The hiring manager collects that data and analyzes it to help them decide whether to hire you or not. But it goes both ways. You could also collect your own data about the company to help you decide if the company is a good fit for you, or you can use the data you collect to come up with thoughtful questions to ask the interviewer. Scientists also generate data. They use a lot of observations in their work. For example, they might collect data by studying animal behavior or looking at bacteria under a microscope. Earlier, we talked about the forms that the US Census Bureau uses to collect data. Forms, questionnaires, and surveys are commonly used ways to collect and generate data. One thing to note, data that's generated online doesn't always happen directly.
Have you ever wondered why some online ads seem to make really accurate suggestions? Or how some websites remember your preferences? This is done using cookies, which are small files stored on computers that contain information about users. Cookies can help inform advertisers about your personal interests and habits, based on your online surfing, without personally identifying you. As a real-world analyst, you'll have all kinds of data right at your fingertips and lots of it too. Knowing how it's been generated can help add context to the data, and knowing how to collect it can make the data analysis process more efficient. Coming up, you'll learn how to decide what data to collect for your analysis. So stay tuned. [MUSIC PLAYING]
We've talked a lot about all the data out there in the world. But as a data analyst, you'll need to decide what kind of data to collect and use for every project. And with a nearly endless amount of data out there, this can be quite a bit of a data dilemma. But there's good news. In this video, you'll learn which factors to consider when collecting data. Usually, you'll have a head start in figuring out the right data for the job because the data you need will be given to you, or your business task or problem will narrow down your choices. So let's start with the question, what's causing increased rush hour traffic in your city? First, you need to know how the data will be collected. You might use observations of traffic patterns to count the number of cars on city streets during particular times. You notice that cars are getting backed up on a specific street. That brings us to data sources. In our traffic example, your observations
would be first-party data. This is data collected by an individual or group using their own resources. Collecting first-party data is typically the preferred method because you know exactly where it came from. You might also have second-party data, which is data collected by a group directly from its audience and then sold. So in our example, if you aren't able to collect your own data, you might buy it from an organization that's led traffic-pattern studies in your city. This data didn't start with you. But it's still reliable because it came from a source that has experience with traffic analysis. The same can't always be said about third-party data or data collected from outside sources who did not collect it directly. This data might have come from a number of different sources before you investigated it. So it might not be as reliable. But that doesn't mean it can't be useful. You'll just want to make sure you check it for accuracy, bias, and credibility.
Actually, no matter what kind of data you use, it needs to be inspected for accuracy and trustworthiness. We'll learn more about that process later. For now, just remember that the data you choose should apply to your needs and it must be approved for use. As a data analyst, it's your job to decide what data to use, and that means choosing the data that can help you find answers and solve problems and not getting distracted by other data. In our traffic example, financial data probably wouldn't be that helpful. But existing data about high-volume traffic times would be. OK. Now let's talk about how much data to collect. In data analytics, a population refers to all possible data values in a certain data set. So if you're analyzing data about car traffic in a city, your population would be all of the cars in that area. But collecting data from the entire population can be pretty challenging. That's why a sample can be useful. A sample is a part of a population
that is representative of the population. You might collect a data sample about one spot in the city and analyze the traffic there, or you might pull a random sample from all existing data in the population. How you choose your sample will depend on your project. As you collect data, you'll also want to make sure you select the right data type. For traffic data, an appropriate data type could be the dates of traffic records stored in a date format. The dates could help you figure what days of the week there is likely to be a high volume of traffic in the future. We'll explore this topic in more detail soon. Finally, you need to determine the time frame for data collection. In our example, if you needed an answer immediately, you'd have to use historical data, which is data that already exists. But let's say you needed to track traffic patterns over a long period of time. That might affect the other decisions you
make during data collection. And now you know more about the different data collection considerations you'll use as a data analyst. And because of that, you'll be able to find the right data when you start collecting it yourself. There's still more to learn about data collection. So stay tuned. [MUSIC PLAYING] I don't know about you, but when I'm choosing a movie to watch, I sometimes get stuck between a couple of choices. If I'm in the mood for excitement or suspense, I might go for a thriller. But if I need a good laugh, I'll choose a comedy. If I really can't decide between two movies, I might even use some of my data analysis skills to compare and contrast them. Come to think of it, there really needs to be more movies about data analysts. I'd watch that.
But since we can't watch a movie about data, at least not yet, we'll do the next best thing, watch data about movies. We're going to take a look at this spreadsheet with movie data. We know we can compare different movies and movie genres. Turns out, you can do the same with data and data formats. Let's use our movie-data spreadsheet to understand how that works. We'll start with quantitative and qualitative data. If we check out column A, we'll find titles of the movies. This is qualitative data because it can't be counted, measured, or easily expressed using numbers. Qualitative data is usually listed as a name, category, or description. In our spreadsheet, the movie titles and cast members are qualitative data. Next up is quantitative data, which can be measured or counted and then expressed as number. This is data with a certain quantity, amount, or range. In our spreadsheet here, the last two columns show the movie's budget and box office revenue.
The data in these columns is listed in dollars, which can be counted, so we know that data is quantitative. We can go even deeper into quantitative data and break it down into discrete or continuous data. Let's check out discrete data first. This is data that's counted and has a limited number of values. Going back to our spreadsheet, we'll find each movie's budget and box office returns in columns M and N. These are both examples of discrete data that can be counted and have a limited number of values. For example, the amount of money a movie makes can only be represented with exactly two digits after the decimal to represent cents. There can't be anything between $0.01 and $0.02. Continuous data can be measured using a timer. And its value can be shown as a decimal with several places. So let's imagine a movie about data analysts that I'm definitely going to star in someday. You could express that movie's runtime
as one 110.0356 minutes. You could even add fractional data after the decimal point if you needed to. There's also nominal and ordinal data. Nominal data is a type of qualitative data that's categorized without a set order. In other words, this kind of data doesn't have a sequence. Here's a quick example. Let's say you're collecting data about movies. You ask people if they've watched a given movie. Their responses would be in the form of nominal data. They could respond yes, no, or not sure.
These choices don't have a particular order. Ordinal data, on the other hand, is a type of qualitative data with a set order or scale. If you asked a group of people to rank a movie from one to five, some might rank it as a two, others a four, and so on. These rankings are in order of how much each person liked the movie. Now let's talk about internal data, which is data that lives within a company's own systems. For example, if a movie studio had compiled all of the data in the spreadsheet using only their own collection methods, then it would be their internal data. The great thing about internal data is that it's usually more reliable and easier to collect. But in this spreadsheet, it's more likely that the movie studio had to use data owned or shared by other studios and sources because it includes movies they didn't make. That means they'd be collecting external data. External data is, you guessed it,
data that lives and is generated outside of an organization. External data becomes particularly valuable when your analysis depends on as many sources as possible. A great thing about this data is that it's structured. Structured data is data that's organized in a certain format, such as rows and columns. Spreadsheets and relational databases are two examples of software that can store data in a structured way. You might remember our earlier exploration of structured thinking, which helps you add a framework to a problem so that you can solve it in an organized and logical manner. You can think of structured data in the same way. Having a framework for the data makes the data easily searchable and more analysis-ready. As a data analyst, you'll work with a lot of structured data, which will usually be in the form of a table, spreadsheet, or relational database. But, sometimes, you'll come across unstructured data. This is data that is not organized in any easily
identifiable manner. Audio and video files are examples of unstructured data because there's no clear way to identify or organize their content. Unstructured data might have internal structure, but the data doesn't fit neatly in rows and columns like structured data. And there you have it. Hopefully, you're now more familiar with data formats and how you might use them in your work. And in just a bit, you'll continue to explore structured data and learn even more about the data you'll use most often as an analyst. Coming soon to a screen near you. [MUSIC PLAYING]
Earlier, we compared some data formats, including structured and unstructured data. Most of the data being generated right now is actually unstructured. Audio files, video files, emails, photos, and social media are all examples of unstructured data. These can be harder to analyze in their unstructured format. But here's the good news. You'll be working with structured data most of the time. For example, if you need to analyze data about the unstructured data in emails, photos, and social media sites, it'll most likely be structured for analysis before you even get to it. Because of that, I want to explore structured data bit more. As a quick refresher, structured data is data organized in a format, like rows and columns, but there's definitely more to it than that. Structured data works nicely within a data model, which is a model that is used for organizing data elements and how they relate to one another. What are data elements?
They're pieces of information, such as people's names, account numbers, and addresses. Data models help to keep data consistent and provide a map of how data is organized. This makes it easier for analysts and other stakeholders to make sense of their data and use it for business purposes. In addition to working well within data models, structured data is also useful for databases. This makes it easy for analysts to enter, query, and analyze the data whenever they need to. This also helps make data visualization pretty easy because structured data can be applied directly to charts, graphs, heat maps, dashboards, and most other visual representations of data. All right. So now we know that spreadsheets and databases that store data sets are widely used sources of structured data. After you explore some other data structures, you'll check out more data types using a spreadsheet. The adventure continues. [MUSIC PLAYING]
By now you've learned a lot about data. From generated data to collected data to data formats, it's good to know as much as you can about the data you'll use for analysis. In this video, we'll talk about another way you can describe data-- the data type. A data type is a specific kind of data attribute that tells what kind of value the data is. In other words, a data type tells you what kind of data you're working with. Data types can be different depending on the query language you're using. For example, SQL allows for different data types depending on which database you're using. For now though, let's focus on the data types that you'll use in spreadsheets. To help us out, we'll use a spreadsheet that's already filled with data. We'll call it Worldwide Interest in Sweets through Google searches. Now, a data type in a spreadsheet can be one of three things-- a number, a text or string, or a Boolean. You might find spreadsheet programs that classify them a bit differently
or include other types. But these value types cover just about any data you'll find in spreadsheets. We'll look at all of these in just a bit. Looking at columns B, D, and F, we find number of data types. Each number represents the search interest for the terms "cupcakes," "ice cream," and "candy" for a specific week. The closer a number is to 100, the more popular that search term was during that week. 100 represents peak popularity. Keep in mind that, in this case, 100 is a relative value, not
the actual number of searches. It represents the maximum number of searches during a certain time. Think of it like a percentage on a test. All other searches are then also valued out of 100. You might notice this in other data sets as well. Gold star for 100. If you needed to, you could change the numbers into percents or other formats, like currency. These are all examples of number data types. In column H, the data shows the most popular treat for each week, based on the search data. So as we'll find and sell H4 for the week beginning July 28, 2019, the most popular treat was ice cream. This is an example of a text data type, or a string data type, which is a sequence of characters and punctuation that contains textual information. In this example, that information would be the treats and people's names. These can also include numbers like phone numbers or numbers in street addresses. But these numbers wouldn't be used for calculations.
So in this case, they're treated like text, not numbers. In columns C, E and G, it seems like we've got some text. But the text here isn't a text or string data type. Instead, it's a Boolean data type. A Boolean data type is a data type with only two possible values, true or false. Columns C, E, and G show Boolean data for whether the search interest for each week is at least 50 out of 100. Here's how it works. To get this data, we've created a formula
that calculates whether the search interest data in columns B, D, and F is 50 or greater. In cell B4, the search interest is 14. So in cell C4, we find the word "false" because for this week of data the search interest is less than 50. So for each cell in column C, E, and G, the only two possible values are true or false. We could change the formula so other words appear in these cells instead, but it's still Boolean data. You'll get a chance to read more about the Boolean data type soon.
Let's talk about a common issue that people encounter in spreadsheets-- mistaking data types with cell values. For example, in cell B57, we can create a formula to calculate data in other cells. This will give us the average of the search interest in cupcakes across all weeks in the data set, which is about 15. The formula works because we calculated using a number data type. But if we tried it with a text or string data type, like the data in column C, we'd get an error. Error values usually happen if a mistake is made in entering the values in the cells. So the more your data types and which ones to use, the less errors you'll run into. There you have it, a data type for everyone. And we're not done yet. Coming up, we'll go deeper into the relationship between data types, fields, and values. See you soon. [MUSIC PLAYING]
Here's a riddle for you. What do a music playlist, a calendar agenda, and an email inbox have in common? I'll give you a hint. It's not a weekly jam session. The answer is, they're all arranged in tables. Go ahead and check out your email inbox or a favorite playlist, or look at your calendar agenda. There's tables in every one. A data table, or tabular data, has a very simple structure. It's arranged in rows and columns. You can call the rows records and the columns fields. They basically mean the same thing. But records and fields can be used for any kind of data table, while rows and columns are usually reserved for spreadsheets. When talking about structured databases, people in data analytics usually go with records and fields. Sometimes, a field can also refer to a single piece of data, like the value in a cell. In any case, you'll hear both versions of these terms used throughout this program and your job. Let's go back to our playlist example.
We'll use the new terms we just introduced. So each song is a record. Each record has the same fields as the other records in the same order. In other words, the playlist has the same information about each song. Each song characteristic, like the title on the artist, is a field. Each separate field has the same data type, but different fields can have different types. Let me show you what I mean. For the song list, the song titles are a text or string type, while the song's length could be a number type if you're using it for calculations, or it could be a date and time type. The column for favorites is Boolean since it has two possible values, favorite or not favorite. We can view spreadsheets in the same way. The records in a spreadsheet might be about all sorts of things-- clients, products, invoices, or really anything else. Each record has several fields which reveal more about the clients, products, or invoices.
The value in every cell contains a specific piece of data, like the address of a client or the dollar amount of an invoice. As a data analyst, lots of data will come your way. And records, fields, and values in data tables will help you navigate analysis. Understanding the structures of the tables you're working with is a part of that. And hopefully, while you're working hard on your analysis in those tables, you can have a little fun with a different data table, the one with your favorite playlist. [MUSIC PLAYING] You probably use the words "wide" and "long" all the time. You might use "wide" to describe the size of something from side to side, like a wide river. But a river can also travel great distances, so you might call it long as well. Wait. Before you stop the video, I promise you didn't accidentally click in the wrong course. I'm not here to teach you words you already know. But the words "wide" and "long" can be used to describe data too. So I am here to help you understand
wide data and long data. So far you've dealt with data arranged mostly in a wide format. With wide data, every data subject has a single row with multiple columns to hold the values of various attributes of the subject. Here's some wide data in a spreadsheet. You might remember we discussed this data about the population of Latin and Caribbean countries earlier. For this data set, each row provides all of the population information about one country. Each column shows the population for a different year. For example, you'll find the annual population of Argentina in row two. Wide data lets you easily identify and quickly compare different columns. In our example, the data is arranged alphabetically by country. So you can compare the annual populations of Antigua and Barbuda, Aruba and the Bahamas, by just checking out the values in each column. The wide data format also makes it easy to find and compare the countries populations
at different periods of time. For example, by sorting the data, we discover that Brazil had the highest population of all countries in 2010. And the British Virgin Islands have the lowest population of all countries in 2013. OK. Now let's explore this data in a long format. Here, the data is no longer organized into columns by year. All the years are now in one column with each country, like Argentina appearing in multiple rows, one for each year of data. This is how long data usually looks.
Long data is data in which each row is one time point per subject, so each subject will have data in multiple rows. Our spreadsheet is formatted to show each year of population data. Here we see Antigua and Barbuda first. Long data is a great format for storing and organizing data when there's multiple variables for each subject at each time point that we want to observe. With this long data format, we can store and analyze all of this data using fewer columns. Plus, if we added a new variable, like the average age of a population, we'd only need one more column. If we'd use a wide data format instead, we would have needed 10 more columns, one for each year. The long data format keeps everything nice and compact. If you're wondering which format you should use, the simple answer is, it depends. Sometimes, you'll have to transform wide data into a long data format or other times vise versa. You'll probably work with both formats in your job.
And you'll definitely revisit both formats again later in this program. That reminds me, earlier we defined data as a collection of facts. As you've discovered over the last few videos, that collection of facts can take on lots of different formats, structures, types, and more. Learning about all of the ways that data can be presented will be a big help to you throughout the data analysis process. The more you work with data in all its forms, the quicker you'll start to recognize which data to use and when to use it. And in just a bit, you'll use all that data stored in your brain to help you take an assessment. After that, you'll learn how to identify and avoid bias in data and how to embrace credibility, integrity, and ethics. The data adventure moves forward. I'm so glad you're moving with it. TONY: Congratulations on finishing this video from the Google Data Analytics Certificate.
Access the full experience, including job search help, and start to earn the official certificate by clicking the icon or the link in the description. Watch the next video in the course by clicking here. And subscribe to our channel for more from upcoming Google career certificates.

Ask anything
We've read this whole study set, so questions about it get the best answers.