Data Types and Structures


Data Types and Structures

Anna
Imagine you’ve asked the right questions, defined a business problem, and understood what your stakeholders need. You’re off to a strong start—but before analysis can tell a useful story, you have to prepare the data. That means understanding what kinds of data are available, how they’re structured, and whether they’re appropriate for the question.

Michael
And preparation is more than just getting a spreadsheet open. It includes choosing data that fits the problem, understanding how it was generated or collected, and knowing how to organize and protect it. In this course, those skills build on the data analysis process: ask, prepare, process, analyze, share, and act.

Anna
A useful example comes from health care analytics. An analyst might compare Medicare enrollment over time with how people search Google for Medicare plans. The goal is to understand whether enrollment is increasing and what role search activity might play in demand.

Michael
But the story can only be useful if the data is relevant and valid. The analyst also needs to consider access and equity, and protect the privacy of people conducting searches. The payoff is findings that can help medical professionals and their patients.

Anna
That example captures a broader point: data can be a powerful part of a story, but the analyst has to choose and handle it responsibly. Preparing data involves learning how it is generated and collected, exploring formats, types, and structures, and checking data for bias, credibility, and cleanliness.

Michael
It also involves practical tools and habits. Analysts use databases, spreadsheets, and SQL to access data, and they need to organize and protect it. These skills take patience and practice, but they help make analysis more useful and trustworthy.

Anna
Let’s start with where data comes from. Data is information, and it is often generated through people’s activity in the world. Digital activity creates enormous amounts: texts, emails, searches, videos, social media posts, and photos.

Michael
Even a photo can contain many pieces of data. The image itself is one item, but it also contains information such as its pixels and the colors in those pixels. Data can also be generated when someone deliberately collects information.

Anna
For example, the U.S. Census Bureau collects information about the population using forms. That information can help guide funding for schools, hospitals, and fire departments. The Bureau also collects information about businesses, and its annual business survey can help reveal their needs and what resources might help them succeed.

Michael
Surveys are useful in other fields too. In health care, a survey might ask patients how they feel about telemedicine compared with in-person visits. The collected responses can help companies improve the care patients receive.

Anna
Data collection doesn’t always require a formal survey. An interview is a form of information gathering: a hiring manager may collect information from a job candidate and use it to help decide whether to hire. The candidate can also gather information about the company and use it to decide whether the job is a good fit.

Michael
Observation is another way to generate data. Scientists might observe animal behavior or examine bacteria under a microscope. Forms, questionnaires, and surveys are common collection methods, but the method depends on what information the question calls for.

Anna
Some online data is generated indirectly. Cookies are small files stored on computers that contain information about users. They can help websites remember preferences and help advertisers understand interests or habits based on online activity, without personally identifying the user.

Michael
Understanding how data was generated gives it context. It can also help an analyst plan a more efficient collection process. But because data collection can involve people’s information, it needs to be handled with consideration for people’s rights and privacy.

Anna
Once you know the question, the next challenge is deciding what data to use. Sometimes a project gives you a head start by supplying data, or the business problem narrows your choices. Either way, the data needs to apply to the task and be approved for use.

Michael
Take the question, ‘What is causing increased rush-hour traffic in a city?’ You might observe traffic and count cars on particular streets at particular times. If you see a backup on one street, that observation gives you a useful lead—but you still need to think about the source and reliability of the data.

Anna
First-party data is collected by an individual or group using its own resources. It’s often preferred because you know where it came from. Second-party data is collected directly from an audience by another group and then sold. In the traffic example, that could mean buying data from an organization that conducted traffic-pattern studies in the city.

Michael
Third-party data comes from outside sources that didn’t collect it directly for you, and it may have passed through several sources. That can make its reliability less clear. It may still be useful, but you should check its accuracy, bias, and credibility.

Anna
And those checks aren’t only for third-party data. Whatever its source, data should be inspected for accuracy and trustworthiness. The analyst’s job is to choose information that can help answer the question—not get distracted by data that is unrelated.

Michael
For instance, financial data probably won’t explain rush-hour traffic as directly as information about high-volume traffic times. Relevance matters: the data should connect to the problem you’re trying to solve.

Anna
You also have to decide how much data to collect. A population is all possible data values in the group you’re studying. For city traffic, the population could be all the cars in the area.

Michael
Collecting information about an entire population can be difficult, so analysts may use a sample. A sample is a part of a population that represents it. You could study traffic at one location or select a random sample from the broader set of traffic data.

Anna
The right sampling approach depends on the project. The important idea is that the sample should be useful for understanding the population, rather than being chosen without regard to what the project needs.

Michael
The type of data matters too. For traffic analysis, dates stored in a date format might help you identify which days of the week tend to have high traffic. A suitable data type makes the information easier to use for the intended question.

Anna
Finally, consider the collection time frame. If you need an answer immediately, you may have to use historical data—data that already exists. If you need to track patterns over a long period, that changes how you plan the collection.

Michael
So the core decisions are connected: how the data will be collected, where it comes from, how much you need, what type it should be, and when you need it. Those choices help you find data that fits the analysis.

Anna
Now let’s distinguish several ways to describe data. Qualitative data is descriptive or categorical; it can’t be counted or measured in the same way as a quantity. In a movie spreadsheet, titles and cast members are qualitative because they’re names or descriptions.

Michael
Quantitative data can be counted or measured and expressed as a number. A movie’s budget and box-office revenue are examples because they’re amounts of money. Quantitative data can be broken down further into discrete and continuous data.

Anna
Discrete data is counted and has a limited set of possible values. For example, a monetary amount recorded to the nearest cent has two digits after the decimal; there isn’t a value between one cent and two cents.

Michael
Continuous data is measured and can take values across a range, including many decimal places. A movie’s runtime could be recorded with fractional precision, such as 110.0356 minutes, if that level of precision is needed.

Anna
Qualitative data can also be nominal or ordinal. Nominal data consists of categories without a set order. If people answer whether they watched a movie with ‘yes,’ ‘no,’ or ‘not sure,’ those responses are nominal.

Michael
Ordinal data has an order or scale. If people rank a movie from one to five, the rankings have an order that represents how much they liked it. The distinction is whether the categories have a meaningful sequence.

Anna
Another distinction is where data lives. Internal data is held within an organization’s own systems. If a movie studio made a spreadsheet using only data it collected itself, that would be internal data.

Michael
External data is generated or held outside an organization. A movie spreadsheet that includes films from other studios would likely rely on information from outside the studio. External data can be especially valuable when an analysis benefits from drawing on many sources.

Anna
Data can also be described by how it is organized. Structured data follows an identifiable format, often rows and columns. Spreadsheets and relational databases can store structured data, which is generally easy to search and prepare for analysis.

Michael
Unstructured data doesn’t fit neatly into a recognizable table. Audio and video files are examples, as are emails, photos, and social media content. They may have some internal organization, but their content isn’t naturally arranged in rows and columns.

Anna
A lot of data being generated is unstructured, but analysts often work with structured data. Even if the subject is emails, photos, or social media, the information may be organized into a structured form before an analyst receives it.

Michael
Structured data works well with a data model. A data model organizes data elements and shows how they relate to each other. Data elements are individual pieces of information, such as names, account numbers, and addresses.

Anna
A model helps keep data consistent and provides a map of how it is organized. That can help analysts and other stakeholders understand the data and use it for business purposes. Structured data is also useful in databases, where analysts can enter, query, and analyze it.

Michael
Because structured data is organized, it can also be used directly in visualizations such as charts, graphs, heat maps, and dashboards. Its clear format helps make it easier to move from data to a visual representation.

Anna
Let’s zoom in on data types, which tell you what kind of value a piece of data contains. Data types can vary by query language and database, but in spreadsheets, three common types are numbers, text or strings, and Booleans.

Michael
Number data is used for numeric values. In a spreadsheet about worldwide interest in sweets, search-interest values for terms like ‘cupcakes,’ ‘ice cream,’ and ‘candy’ are numbers. In that example, 100 represents peak popularity relative to the other values, not the actual number of searches.

Anna
Text, or string, data is a sequence of characters and punctuation that contains textual information. Treat names and treat labels as text. Some entries can contain digits—like a phone number or street address—but if those digits aren’t meant for calculations, they’re treated as text rather than numerical data.

Michael
A Boolean has only two possible values: true or false. In the sweets spreadsheet, a formula checks whether a search-interest value is at least 50. If the value is below 50, the result is false; if it meets the condition, the result is true.

Anna
It’s important not to confuse a data type with a cell’s particular value. A cell might contain a number, but the type tells you how that value can be used. For example, a formula can calculate the average of numeric search-interest values.

Michael
Trying to calculate an average from text values instead can produce an error. Errors can also result from mistakes in entering cell values. Knowing which data types are appropriate helps you use formulas correctly and avoid some common spreadsheet problems.

Anna
Now let’s talk about how data is laid out in a table. Tabular data is arranged in rows and columns. In data analytics, rows are often called records and columns are often called fields, especially when talking about databases.

Michael
Those terms can overlap: rows and columns are common spreadsheet language, while records and fields are often used for structured databases. Sometimes ‘field’ can also refer to a single piece of data, such as a cell’s value, so you may hear the terms used in more than one way.

Anna
Think of a playlist. Each song is a record, and each record has the same fields in the same order—for example, a title, an artist, and a length. Each field has a data type, though different fields can have different types.

Michael
A song title is text. A song length could be a number if you’re using it in calculations, or it could be represented as a time value. A ‘favorite’ field could be Boolean if it has only two possible states: favorite or not favorite.

Anna
The same structure applies to spreadsheets about clients, products, or invoices. Each record describes one item, and its fields provide consistent information about that item. Each cell’s value is a particular piece of data, such as a client address or an invoice amount.

Michael
Understanding records, fields, and values helps you navigate tables and interpret what each piece of data represents. It’s part of understanding the structure of the data before you begin analyzing it.

Anna
There are also two common ways to arrange data over time: wide and long. In wide data, each subject has one row, and different columns hold values for that subject’s attributes or time points.

Michael
Imagine a population table with one row per country and a separate column for each year. You can quickly compare countries within a year, or compare one country’s values across the year columns. Sorting can also help identify which country had the highest or lowest population in a particular year.

Anna
In long data, each row represents one time point for one subject, so a subject appears on multiple rows. The population table would have a year column and a country column, with a separate row for each country-year combination.

Michael
Long format can be compact when you have many time points or multiple variables for each subject. If you add a variable such as average age, you can add a column. In a wide format, you might need a separate new column for every year of that variable.

Anna
Wide and long each have strengths, so neither is always the right answer. You may need to transform one format into the other depending on the project, and analysts often work with both.

Michael
That’s the larger lesson of data preparation: data can differ in its source, amount, collection time, type, and structure. Recognizing those differences helps you choose and use data that fits the question, while keeping accuracy, credibility, bias, privacy, and responsible handling in view.

Anna
And once you have suitable data, you still need to organize and protect it, then use tools such as spreadsheets, databases, and SQL to work with it. With practice, you’ll get quicker at recognizing what kind of data you have and what form will best support your analysis.

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