Data can be defined as useful information or facts. In today’s world data is the backbone of technology. Most advancements and new features are totally dependent on data.

Data powers new age technology such as Machine learning, Artificial Intelligence, data processing and analytics,etc. 

Why to clean Data?

Data that we get from sources such as surveys and social media platforms has certain inconsistencies.

Some part of the data might be missing whereas some may be incorrect.

If we simply use this data for our algorithms and machines, classification can be inaccurate and we might not reach the expected result.

This might be less problematic and have low effect for small problems but certain fields such as the health sector and  many areas which are very much dependent on data can cause great harm and defamation.

Therefore, It is very important to clean data.

How to clean Data?

Data cleaning is technique to remove the noisy data and correct certain inconsistencies which are present in data.

It involves identifying or removing outliers, filling missing data, resolving inconsistency and smoothing noise in data.


  1. Locate and identify individual data elements in source systems and isolate these items in target files.
  2. Use data algorithms to correct individual data elements.
  3. Using standard and business rules transform data into consistent form.
  4. Eliminate duplications by searching and matching duplicates in data.
  5. Analyze and identify the relationship between matched records and match them into one record.


This is a simple example for data cleaning. 

Before cleaning:

CustId CustomerFName CustomerLName Contact

001 Sam abc 011123

002 Badri none 123456

003 Michael na 098765

004 Issac newton gravity falls,9999

005 Albert einstein relative,009945

After cleaning:

Custid CustomerName Contact

001 Sam Abc 011123

002 Badri 123456

003 Micheal 098765

004 Issac Newton 9999

005 Albert Einstein 009945

Data Cleaning using Python:

Python is a powerful data processing language. It has a set of libraries that can easily and fastly modify or clean our data. We are going to see some of them like Numpy and Pandas.

First import libraries:

>>import numpy as np

>>import pandas as pd

To drop columns:



>>drop_list=[name of columns to be dropped]




To change index:


Remove extra space or Tidy data:

>>spc=ds[“column name”].str.extract(regex,expand=false)

Combining str methods with numpy to clean data:


>>ds[“columnname”]=np.where(column_value,then operation,else)

Renaming column name:



%d bloggers like this: