The importance and process of cleaning data
Once the data has been acquired, it will need to be cleaned. Frequently, the data will contain errors, duplicate entries, or be inconsistent. It often needs to be converted to a simpler data type such as text. Data cleaning is often referred to as data wrangling, reshaping, or munging. They are effectively synonyms.
When data is cleaned, there are several tasks that often need to be performed, including checking its validity, accuracy, completeness, consistency, and uniformity. For example, when the data is incomplete, it may be necessary to provide substitute values.
Consider CSV data. It can be handled in one of several ways. We can use simple Java techniques such as the String
class' split
method. In the following sequence, a string array, csvArray
, is assumed to hold comma-delimited data. The split
method populates a second array, tokenArray
.
for(int i=0; i<csvArray.length; i++) { tokenArray[i] = csvArray[i].split(","); }
More complex data...