text stringlengths 55 1.76k |
|---|
DATA CLEANING A free resource by THE ULTIMATE GUIDE TO |
Table of Contents ● Introduction....... Get ting Started with Data Cleaning ● Chapte r 1............. Rows and Columns: The Building Blocks of Data Cleaning ● Chapte r 2............. Run Quick Data Checks ● Chapte r 3............. Check Different Question Types ● Chapte r 4............. Deal with Missing Data ● Chapte ... |
INTRODUCTION Getting Started with Data Cleaning You have spent time and energy designing a questionnaire that focuses on important topics. Your surveyors have worked with respondents to ensure quality data collection. Now, it is up to you to turn all this hard work and preparation into meaningful insights. What do y ou... |
TOOL TIP Data cleaning (also called data cleansing) is the process of finding and dealing with problematic data points within a data set. Data cleaning can involve fixing or removing incomplete data, cross checking data against a validated data set, standardizing inconsistent data, and more. Data scientists usually spe... |
CHAPTER 1 Rows and Columns: The Building Blocks of Data Cleaning Understanding how to structure your data into rows and columns is a crucial first step in cleaning any data set, especially in survey data cleaning. All manipulation and analysis that you perform on the data depends on the framework of rows and columns. L... |
Understanding the structure of your data is a crucial first step in cleaning any data set. The way a data set is laid out is just as important as the actual values, because the structure determines how the data can be manipulated and interpreted. The main components of a data set that we are concerned with are columns,... |
TOOL TIP In Col lect, our mobile data collection tool, you can add an alias for every question while building your survey! Because columns store information for one variable, data in each column should always be similar. In Chapter 3, we will learn functions in Excel that help us clean data over an entire column or var... |
It is a good practice to keep a dictionary — an Excel sheet with the two columns containing information on “Survey Question” and “Alias” — which clearly links each alias to the original survey question or variable. This will help people who are viewing a data set of survey responses for the first time. Rows Rows are th... |
Cells Every intersection of a row and column is called a cell. A cell contains a single data point that defines the value of the variable of the column for the unit of analysis in the row. For example, the spreadsheet to the left has rows with households numbered 1 to 20 and a column titled “Name_HH_Head”. Each cell gi... |
tracking, banking, and more. Other examples of UIDs are driver's license numbers, passport numbers, Aadhar Card numbers in India, Resident Identity Card numbers in China, and National Health Service numbers in the United Kingdom. A unique ID not only helps distinguish units from each other within a single worksheet, bu... |
For example, a unique ID may combine digits representing various levels of geographic information to create a unique ID that represents the geographic location of a unit. At the top of each survey page (or booklet in the case of longer surveys) there should be boxes which enumerators can fill out with the unique ID. Th... |
that there can be a combination of responses that uniquely distinguishes every unit, and 2) because of data cleanliness issues, it may be difficult to find fields that have consistent, reliable responses to include in the concatenated unique ID. If missing or incorrect values in a field are used to create the unique ID... |
CHAPTER 2 Run Quick Sanity Checks Errors can creep into your data in multiple ways. Here's a handy checklist of basic data checks to help you rule out some obvious errors in your data. Performing these easy data checks is a good starting point in your data cleaning process. Chapter 2 will help you learn the following t... |
Conducting a survey is a fantastic way to receive feedback. Before we get down to analyzing the data collected from the survey, however, it is important to ensure that our data is error-free and clean. This requires a good understanding of the behavior of the various variables in the data. This chapter talks about some... |
Data Checks Number of Respondents vs. Rows For any kind of survey, you should always match the number of rows in your data to the number of respondents surveyed to ensure data completeness. For example, for a survey involving 500 households, the first step will be to ensure the number of rows in your data set equals 50... |
Number of Questions vs. Columns Make sure to be well-versed with the structure of your survey — have a thorough understanding of all question and response types. It will be of immense help when you validate the responses received for these questions. You can then quickly match the total number of columns in your spread... |
Consider the sales data for XYZshopping. com. Columns J and K contain the lat-long of the location where each transaction was made. Since we know that no one made a transaction from the middle of the Indian Ocean, find the transactions that have incorrect lat-longs from this area. Hint: Use this formula in an empty col... |
No matter what format you choose, it is important to keep it consistent throughout the data set. Also ensure that the second, minute, hour, day, month, and year are valid. For instance, in the DD-MM-YY format, the date 35-13-16 would be incorrect because the day and month cannot go beyond 31 and 12 respectively. In cas... |
CHAPTER 3 Check Different Question Types Question types help you set expectations for the range and format of responses that you receive in your survey. Assigning specific question types to your questions will help you identify and deal with values outside the anticipated range of responses. Learn about common question... |
If you asked 50 people their age, what types of responses would you expect to receive? You might expect the response to be a number. You could also expect it to be greater than 0 and less than, say, 120. However, if someone answered with a name or phrase, you would likely record this as a bad response. Setting such exp... |
responses should only fall within the categories provided. For example, an enumerator may be asked to assess whether a property is “Residential”, “Commercial”, or “Empty”. Many surveys also provide an “Other” option with a comments section for responses that do not fall within the category options. You can code respons... |
so the format of a date should be clearly standardized prior to beginning a survey. This ensures consistency across survey responses. Strings String responses comprise of a sequence of characters and are often a word or group of words. For example, responses to the question, “What is the name of the head of household?”... |
One useful tool in Excel is Data Validation. The Data Validation tool is located on the Data tab of the ribbon at the top of the Excel workspace. In this tool, you can customize settings to run automatic checks on data within a column. For example, if you are cleaning a column called “Age of Household Head,” you know t... |
Setting up data validation rules prior to data entry can significantly increase data quality and make it easier to clean data later on. Using the Sort and Filter Tools The Sort tool is a simple way to change the order of your data. It makes it easy to spot outliers or data with different data types. For example, if one... |
Specific Validations for Strings What if you want to know the specific length of string responses? An easy way to measure the length of responses is by using the LEN function in Excel. In a blank column, type the function =LEN() in the cell adjacent to the row you are measuring. To apply the function to the rest of the... |
CHAPTER 4 Deal with Missing Data Most data sets have instances of missing data. Incomplete or missing data points, no matter how few, can reduce your sample size (the number of people or entities in your data set) considerably. Learn how to appropriately deal with missing data to ensure the best balance between data ac... |
Data is almost never complete or perfect. In most practical cases, some amount of variables would be missing. Missing or partial information, no matter how few in number, can reduce the sample size considerably. Why Do Missing Values Arise? Data could have missing values due to a number of reasons. Some of them are avo... |
A way around this problem is to incorporate questions that can extract the required information without making respondents uncomfortable. For example, in order to estimate the respondent's income, they can be questioned about their property, income tax paid, and so on. Dropouts in Longitudinal Data Analysis Longitudina... |
The objective of a study is usually to learn more about the behavior of, or establish patterns in, the values of dependent variables, and then use independent variables to explain their behavior. EXERCISE 1 Consider the sales data for XYZshopping. com. Assume that we are looking to analyze country-wise consumption patt... |
TOOL TIP Use this method when — in a particular row — either the dependent variable being studied or too many independent variables are missing. EXERCISE 2 Consider the sales data for XYZshopping. com. Assume that we are looking to analyze country-wise consumption patterns (products bought and expenditures). Look at mi... |
●M ean: Mean — commonly known as average — is equal to the sum of all values in the column divided by the number of values present in the column. In Excel, use the AVERAGE() function to directly compute the mean. ●M edian : Median is the “middle” value amongst the range of values. To compute the median of a range conta... |
Last Observation Carried Forward (LOCF) LOCF is a technique specific to longitudinal data analysis. This is a crude method where a missing value for a particular row is filled in with a value available from the previous stages. Pro: Ensures no sample size loss from dropouts Con: Can only be applied to longitudinal data... |
CHAPTER 5 Handle Outlier Detection Data points that are significantly different from other data points are called outliers. Outlier detection is crucial since outliers can skew the interpretation of data. Outliers can be accurate or inaccurate. Learn different ways to detect outliers and deal with inaccurate data bette... |
Imagine that you generally keep spare change and small bills in your pocket. If you reach in your pocket and find a $1 bill, a quarte r, a dime, and 3 pennies, you won't be surprised. If you find a $100 bill, you will certainly be surprised. That $100 bill is an outlier — a data point that is significantly different fr... |
Outliers are inevitable, especially for large data sets. On their own, they are not problematic. However, in the context of the larger data set, it is essential to identify, verify, and accordingly deal with outliers to ensure that your data interpretation is as accurate as possible. Identifying Outliers The first step... |
EXERCISE 1 Consider the sales data for XYZshopping. com. Column D contains the price of the product purchased in each transaction. Create a histogram for this data. Hint: You can create a histogram in Excel using the “Data Analysis” tool by following these steps:1. Add th e buckets/bins, for which you want to count the... |
This scatter plot of our pocket change example shows an outlier — far away from all the other points — for Day 4 ($101. 2). EXERCISE 2 Consider the sales data for XYZshopping. com. Column D contains the price of the product purchased in each transaction, whereas Column B contains the transaction date. Create a scatterp... |
Step 1: Sort the Data Sort the data in the column in ascending order (smallest to largest). You can do this in Excel by selecting the “Sort & Filter” option in the top right in the home toolbar. Sorting the data helps you spot outliers at the very top or bottom of the column. Here is the data sorted for the pocket chan... |
Step 2: Quartiles In any ordered range of values, there are three quartiles that divide the range into four equal groups. The second quartile (Q2) is nothing but the median, since it divides the ordered range into two equal groups. For an odd number of observations, the median is equal to the middle value of the sorted... |
=quartile(array containing values, 1/2/3 for Q1/Q2/Q3 respectively) Bear in mind that Excel calculates quartiles differently from the method shown above, although both methods are correct. EXERCISE 3b Find the median, Q1, and Q3 for the sorted data from Exercise 3a. Step 3: Inner and Outer Fences The inner and outer fe... |
minor outliers. A data point that falls outside the outer fence is called a major outlier. Outer Fence Lower bound = Q1-(3 * (Q3-Q1))Upper bound = Q3 + (3 * (Q3-Q1)) In our example, the bounds for the outer fence are: Lower Bound = 0. 565-(3*3. 21) =-9. 07 Upper Bound = 3. 775 + (3*3. 21) = 13. 41 The data point for Da... |
Celsius) over the past two weeks: 30°, 31°, 28°, 30°, 31°, 33°, 32°, 31°, 300°, 30°, 29°, 28°, 30°, 31°. Day 9 had a peak temperature of 300°C, which is clearly unrealistic. On the other hand, when you look at the pocket change example, it is not unrealistic to have $101. 20 in your pocket. It is possible that you just... |
CHAPTER 6 Tackle Conditional Questions In a questionnaire, conditional questions are asked based on the response to a previous question. Conditional questions help you gain more information on the response to a previous question. While adding speed and clarity to a questionnaire, conditional questions also add complexi... |
Conditionality allows you to direct a respondent to a specific question based on his/ her answer to a prior question. For example, the question, “Are you pregnant?” should be asked to a respondent in a survey only if the answer to the question “What is your gender?” is “Female”. Conditional branching takes this a step ... |
In this example, Question 1. 1 should be asked to the respondent only if the answer to Question 1 is “Yes”. If the answer is “No”, the user should be sent to Question 2. The survey should explicitly specify which questions are conditional. In such cases, planning the survey in a flowchart and using a clear protocol to ... |
Data Cleaning Protocol for Conditional Questions Crosschecking with the Survey The first step to cleaning a data set containing conditional questions is to crosscheck all questions — conditional and non-conditional — against the original survey. Make sure that your data set follows the flow that you outlined in your fl... |
The formula returns “Error” in Column D if it finds a non-blank spouse name for an unmarried person. Row 5 c ontains an error because the person in this record is not married (Cell B5 = “No”), but has a spouse (Cell C5 = Non blank) You can now quickly filter on these “Error” rows using the “Filter” command on Column D,... |
EXERCISE 1 In the demographic survey mentioned in Chapter 1, Question 4 has conditional branches: 1. Q4 : How did you come to know about our online shopping site? a. Re commendation from someone b. Ad vertisement c. On line search 2. Q4 a: Who recommended our site to you? a. Fri end b. Coll eague c. Fam ily d. Oth er (... |
CHAPTER 7 Join, Delimit, or Concatenate Data Your data is now clean and structured. Before you go ahead and analyze it, learn these basic data functions to join, delimit, and concatenate your data. These functions will help you make better sense of your data and draw better insights. Chapter 7 will help you learn the f... |
Once your survey data is structured and cleaned at a basic level, you may need to carry out a series of functions across your data set. In this chapter, we cover frequently used operations that will make your data set ready for analysis. Joining Data In Chapter 1, we discussed the importance of creating unique IDs in s... |
Now let's look at an example of how to use the VLOOKUP formula to combine two sheets in Excel. In this example, there are two sheets: ●T he “ Description ” sheet includes an ID for each piece of produce (Produce_ID), the color of each produce (Color), and a description of the produce (Description). ●T he “ Cost ” sheet... |
responses include both the first and last name of the household head separated by a space. If you wish to separate this information into two columns — first_name and last_name — you can delimit the values using the space as the delimiting character. In Excel, click on “Text to Columns” in the “Data” tab of the Excel ri... |
Concatenating Data Concatenating data achieves the opposite of delimiting data — it combines strings from separate fields into one text string. The concatenate function in Excel allows us to carry out this function across all cells. Here's how the concatenate function looks in Excel: =CONCATENATE(comma-separated list o... |
CHAPTER 8 Case Study: Cleaning Data from a Paper-Based Survey At Atlan, our partners have collected data for hundreds of surveys on our mobile data collection tool — Co llect. However, we've learned from experience that cleaning data from a paper-based survey comes with its unique challenges. We have worked on cleaning... |
Now that we have learned the concepts behind basic data cleaning, let us delve deeper into a case study. This is a real-life example from one of the projects we have w orked on. In December 2014, under the Sansad Adarsh Gram Yojana (SAGY) — a rural development program in India focused on tracking and improving various ... |
these, since they were essentially different households, but with incorrect UIDs. ●O ne of these had a repeated combination of household head, address, and household composition. Since this was clearly a case of data duplication, we deleted the entire record. Our data set now had 1,059 rows. Comparing the Columns to th... |
that these two sets represented land and crop characteristics across 2 different plots — Plot 1 and Plot 2. The idea was to compare these characteristics for two different plots. Improper data entry leads to errors like these. A good prior understanding of survey questions helps tackle such issues better, both after an... |
2. Data Checks Households Surveyed vs. Unique Rows in Data The number of households surveyed was 1,060. This did not match the 1,059 unique household IDs in the data. There was a repetitive observation, leading to an incorrect count of household IDs. To correct this anomaly, the duplicated observation was dropped. As a... |
data points were deleted and treated as missing values instead. ●Inte ger variables like “number of cows owned by the household” had values like 1. 5, 9. 75, and so on. Once again, these data points were deleted and instead treated as missing values. ●Anom alies in conditional variables were identified and deleted. For... |
for wages, an outlier of 1,200,000 was detected. By including this one outlier, the average wage rose from 22,200 to 23,800. It was therefore crucial for us to validate the outlier to decide whether or not to include it. To do this, we looked at associated variables such as asset ownership, toilet in the premises, educ... |
When applied on the wage data, the Real Statistics tool highlighted 3 cases with a z-score beyond +2. 5. Once again, these statistically-proven outliers were validatedor deleted by looking at other associated income and lifestyle parameters of the household. 5. Missing Data Instances of missing data — arising from no r... |
Exercise Solutions Chapter 1 1. Columns should be: Name, City, Gender, Age, Discovery (or similar words). 2. Th e solutions are: a. Th e unit of analysis in this data set is the sales transaction. Each row corresponds to one online sales transaction. b. Th ere are 998 sales transactions — hence, units of analysis — in ... |
Chapter 3 1. The data types in each column are: a. Column A: numeric a. Colu mn B: date (in the format 'dd-mm-yyyy hh:mm:ss') b. Colum n C: string c. Column D: numeric d. Colu mn E: categorical (with 4 categories: Amex, Diners, Mastercard, Visa) e. Colu mns F-I: string f. Column s J-K: numeric 2. In the r ows with seri... |
Chapter 5 3b. Using Excel functions, we get: ●Me dian = 1,800 ●Q1 = 8 00 ●Q3 = 3,600 3c. Interquartile range = Q3-Q1 = 2,800 ●Th e outer fence ranges from-7,600 to 12,000. Therefore, 13,000 and 47,000 are major outliers. ●Th e inner fence ranges from-3,400 to 7,800. Therefore, there are no minor outliers. Chapter 6 1. ... |
Written, Edited, and Designed By: Aarti Gupta Apoorv Anand Christine Garcia Lilianna Bagnoli Sahaj Talwar Shilpa Arora Udit Poddar Uttara Rajasekar Vasavi Ayasomayajula |
Try Collect Now!Before you even start cleaning your data, make sure you're collecting good data The world's most resilient data collection tool 1 2 3Collect — our mobile data collection tool — has been used by Google, Tata Trusts, Azim Premji Foundation and others to collect over 20 million survey responses. From intui... |
README.md exists but content is empty.
- Downloads last month
- 4