VOOZH about

URL: https://www.analyticsvidhya.com/blog/2021/08/how-to-perform-exploratory-data-analysis-a-guide-for-beginners/

⇱ How To Perform Exploratory Data Analysis -A Guide for Beginners


India's Most Futuristic AI Conference Is Back – Bigger, Sharper, Bolder

  • d
  • :
  • h
  • :
  • m
  • :
  • s

Reading list

How To Perform Exploratory Data Analysis -A Guide for Beginners

Nimit Last Updated : 24 Mar, 2025
6 min read

Exploratory Data Analysis is a set of techniques that were developed by Tukey, John Wilder in 1970. The philosophy behind this approach was to examine the data before building a model. John Tukey encouraged statisticians to explore the data, and possibly formulate hypotheses that could lead to new data collection and experiments. Today Data scientists and analysts spend most of their time in Data Wrangling and Exploratory Data Analysis also known as EDA. But what is this EDA and why it is so important? This article explains what is EDA and how to apply EDA techniques to a dataset.

In this article, you will learn how to perform exploratory data analysis using Python, R, and SPSS. We will cover simple techniques to help you understand your data better. Whether you want to learn EDA or find out how to do exploratory data analysis, this guide will give you the basic tools you need.

This article was published as a part of the Data Science Blogathon

What is Exploratory Data Analysis?

Exploratory Data Analysis or EDA is used to take insights from the data. Data Scientists and Analysts try to find different patterns, relations, and anomalies in the data using some statistical graphs and other visualization techniques. Following things are part of EDA :

  1. Get maximum insights from a data set
  2. Uncover underlying structure
  3. Extract important variables from the dataset
  4. Detect outliers and anomalies(if any)
  5. Test underlying assumptions
  6. Determine the optimal factor settings

Why EDA is Important?

The main purpose of EDA is to detect any errors, outliers as well as to understand different patterns in the data. It allows Analysts to understand the data better before making any assumptions. The outcomes of EDA helps businesses to know their customers, expand their business and take decisions accordingly.

Also, check out this article for Exploratory Data Analysis!

How to Perform Exploratory Data Analysis (EDA)?

To understand EDA better let us take an example. We will be using Automobile Dataset for analysis.

1. Import Libraries and Load Dataset

Python Code:

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

auto = pd.read_csv('Automobile_data.csv')

print(auto.head())

We can see that the dataset has 26 attributes and column names are missing. We can also observe that there are β€˜?’ at some places which means our data has missing value also. We will fill in column names first.

cols=['symboling','normalized_losses','make','fuel_type','aspiration','num_of_doors','body_style','drive_wheels_engine','location','wheel_base','length','width','height','curb_weight','engine_type','num_of_cylinders','engine_size','fuel_system','bore','stroke','compression_ratio','horsepower','peak_rpm','city_mpg','highway_mpg','price']
auto.columns=cols
auto.head()

We got our column names. The price column is our target variable.

2. Check for Missing Values

auto.isnull().sum()

It is showing that we don’t have any null values in our dataset but we have observed earlier that there were β€˜?’ symbols in the dataset, which means that these symbols are in the form of an object.  Let us now check the data types of each attribute.

auto.info()

We can observe that those columns that have symbols are in object form as well as some columns should be of an integer type but are of an object type. Now let us detect which columns have symbols and if there are any other symbols too.

#Checking for wrong entries like symbols -,?,#,*,etc.
for col in auto.columns:
 print('{} : {}'.format(col,auto[col].unique()))

There are null values in our dataset in form of β€˜?’ only but pandas are not reading them so we will replace them into np.nan form.

for col in auto.columns:
 auto[col].replace({'?':np.nan},inplace=True)
auto.head()

Now we can observe that the β€˜?’ symbols have been converted into NaN form. Let us check for missing values again.

auto.isnull().sum()

We can observe that now there are missing values in some columns.

3. Visualizing the Missing Values

With the help of heatmap, we can see the amount of data that is missing from the attribute. With this, we can make decisions whether to drop these missing values or to replace them. Usually dropping the missing values is not advisable but sometimes it may be helpful too.

sns.heatmap(auto.isnull(),cbar=False,cmap='viridis')

Now observe that there are many missing values in normalized_losses while other columns have fewer missing values. We can’t drop the normalized_losses column as it may be important for our prediction.

4.Replacing the Missing Values

We will be replacing these missing values with mean because the number of missing values is less(we can use median too).

num_col = ['normalized_losses', 'bore', 'stroke', 'horsepower', 'peak_rpm','price']
for col in num_col:
 auto[col]=pd.to_numeric(auto[col])
 auto[col].fillna(auto[col].mean(), inplace=True)
auto.head()

We can observe that now our missing values are replaced with mean.

5. Asking Analytical Questions and Visualizations

This is the most important step in EDA. This step will decide how much can you think as an Analyst. This step varies from person to person in terms of their questioning ability. Try to ask questions related to independent variables and the target variable. For example – how fuel_type will affect the price of the car?

Before this let us check the correlation between different variables, this will give us a roadmap on how to proceed further.

plt.figure(figsize=(10,10))
sns.heatmap(auto.corr(),cbar=True,annot=True,cmap='Blues')

Positive Correlation

  • Price – wheel_base, length, width, curb_weight, engine_size, bore, horsepower
  • wheelbase – length, width, height, curb_weight, engine_size, price
  • horsepower – length, width, curb_weight, engine_size, bore, price
  • Highway mpg – city mpg

Negative Correlation

  • Price – highway_mpg, city_mpg
  • highway_mpg – wheel base, length, width, curb_weight, engine_size, bore, horsepower, price
  • city – wheel base, length, width, curb_weight, engine_size, bore, horsepower, price

Checkout this article about the Exploratory data analysis using python

Questions on Price of the Automobile

Now let us apply domain knowledge and ask the questions which will affect the price of the automobile.

1. How does the horsepower affect the price?

plt.figure(figsize=(10,10))
plt.scatter(x='horsepower',y='price',data=auto)
plt.xlabel('Horsepower')
plt.ylabel('Price')

We can see that most of the horsepower value lies between 50-150 has price mostly between 5000-25000, there are outliers also(between 200-300).

Let’s see a count between 50-100 i.e univariate analysis of horsepower.

sns.histplot(auto.horsepower,bins=10)

The average count between 50-100 is 50 and it is positively skewed.

2. What is the relation between engine_size and price?

plt.figure(figsize=(10,10))
plt.scatter(x='engine_size',y='price',data=auto)
plt.xlabel('Engine size')
plt.ylabel('Price')

We can observe that the pattern is similar to horsepower vs price.

3. How does highway_mpg affects price?

plt.figure(figsize=(10,10))
plt.scatter(x='highway_mpg',y='price',data=auto)
plt.xlabel('Higway mpg')
plt.ylabel('Price')

We can see price decreases with an increase in higway_mpg.

Let us check the number of doors.

#Unique values in num_of_doors
auto.num_of_doors.value_counts()

4. Relation between no. of doors and price

We will use a boxplot for this analysis.

sns.boxplot(x='price',y='num_of_doors',data=auto)

With this boxplot, we can conclude that the average price of a vehicle with two doors is 10000,  and the average price of a vehicle with four doors is 12000.

With this plot, we have gained enough insights from data and our data is ready to build a model.

Endnote

In conclusion, Exploratory Data Analysis (EDA) is a crucial step in data analysis. It helps to understand the nature of the data and identify any patterns or trends hidden within it. We can gain insights into the data using various visualization techniques and statistical methods, which can help make informed decisions. This article has covered some essential techniques for performing EDA, such as summary statistics, data visualization, and correlation analysis. However, EDA is not limited to these techniques, and several other methods can be used depending on the nature of the data. Mastering EDA is essential for building accurate models and making data-driven decisions as a data scientist. If you want to learn more about EDA, consider enrolling in our Blackbelt program for advanced data analysis techniques.

Hope you like the article! Exploratory Data Analysis (EDA) is essential for understanding data. Learn EDA techniques to perform exploratory data analysis in Python, R, or SPSS effectively. Discover how to do exploratory data analysis for insightful results.

I am a dedicated and detail-oriented Data Analyst with a passion for extracting meaningful insights from complex data sets. With a strong background in statistics and data manipulation, I excel in turning raw data into actionable information that drives informed business decisions.I have a deep understanding of statistical analysis, data visualization, and data mining techniques. I am proficient in using various programming languages, including Python and R, as well as popular data analysis and visualization libraries such as pandas, NumPy, and matplotlib. I am also experienced in SQL and database management, allowing me to efficiently extract and manipulate data from various sources.

Login to continue reading and enjoy expert-curated content.

Free Courses

Generative AI - A Way of Life

Explore Generative AI for beginners: create text and images, use top AI tools, learn practical skills, and ethics.

Getting Started with Large Language Models

Master Large Language Models (LLMs) with this course, offering clear guidance in NLP and model training made simple.

Building LLM Applications using Prompt Engineering

This free course guides you on building LLM apps, mastering prompt engineering, and developing chatbots with enterprise data.

Improving Real World RAG Systems: Key Challenges & Practical Solutions

Explore practical solutions, advanced retrieval strategies, and agentic RAG systems to improve context, relevance, and accuracy in AI-driven applications.

Microsoft Excel: Formulas & Functions

Master MS Excel for data analysis with key formulas, functions, and LookUp tools in this comprehensive course.

Responses From Readers

It is very useful blog to understand the concepts of EDA.

Temitope Omotosho

This is a very great content, thanks for putting this together

jainik kochra

hey sir, i am new bee and explore different things i have question after auto.info you use for loop to see unique values but you use this: #Checking for wrong entries like symbols -,?,#,*,etc. for col in auto.columns: print('{} : {}'.format(col,auto[col].unique())) my question: instead of above query we also use below i don't understand why you use format in their for i in df.columns: print(i,df[i].unique())

Flagship Programs

GenAI Pinnacle Program| GenAI Pinnacle Plus Program| AI/ML BlackBelt Program| Agentic AI Pioneer Program

Free Courses

Generative AI| DeepSeek| OpenAI Agent SDK| LLM Applications using Prompt Engineering| DeepSeek from Scratch| Stability.AI| SSM & MAMBA| RAG Systems using LlamaIndex| Building LLMs for Code| Python| Microsoft Excel| Machine Learning| Deep Learning| Mastering Multimodal RAG| Introduction to Transformer Model| Bagging & Boosting| Loan Prediction| Time Series Forecasting| Tableau| Business Analytics| Vibe Coding in Windsurf| Model Deployment using FastAPI| Building Data Analyst AI Agent| Getting started with OpenAI o3-mini| Introduction to Transformers and Attention Mechanisms

Popular Categories

AI Agents| Generative AI| Prompt Engineering| Generative AI Application| News| Technical Guides| AI Tools| Interview Preparation| Research Papers| Success Stories| Quiz| Use Cases| Listicles

Generative AI Tools and Techniques

GANs| VAEs| Transformers| StyleGAN| Pix2Pix| Autoencoders| GPT| BERT| Word2Vec| LSTM| Attention Mechanisms| Diffusion Models| LLMs| SLMs| Encoder Decoder Models| Prompt Engineering| LangChain| LlamaIndex| RAG| Fine-tuning| LangChain AI Agent| Multimodal Models| RNNs| DCGAN| ProGAN| Text-to-Image Models| DDPM| Document Question Answering| Imagen| T5 (Text-to-Text Transfer Transformer)| Seq2seq Models| WaveNet| Attention Is All You Need (Transformer Architecture) | WindSurf| Cursor

Popular GenAI Models

Llama 4| Llama 3.1| GPT 4.5| GPT 4.1| GPT 4o| o3-mini| Sora| DeepSeek R1| DeepSeek V3| Janus Pro| Veo 2| Gemini 2.5 Pro| Gemini 2.0| Gemma 3| Claude Sonnet 3.7| Claude 3.5 Sonnet| Phi 4| Phi 3.5| Mistral Small 3.1| Mistral NeMo| Mistral-7b| Bedrock| Vertex AI| Qwen QwQ 32B| Qwen 2| Qwen 2.5 VL| Qwen Chat| Grok 3

AI Development Frameworks

n8n| LangChain| Agent SDK| A2A by Google| SmolAgents| LangGraph| CrewAI| Agno| LangFlow| AutoGen| LlamaIndex| Swarm| AutoGPT

Data Science Tools and Techniques

Python| R| SQL| Jupyter Notebooks| TensorFlow| Scikit-learn| PyTorch| Tableau| Apache Spark| Matplotlib| Seaborn| Pandas| Hadoop| Docker| Git| Keras| Apache Kafka| AWS| NLP| Random Forest| Computer Vision| Data Visualization| Data Exploration| Big Data| Common Machine Learning Algorithms| Machine Learning| Google Data Science Agent
πŸ‘ Av Logo White

Continue your learning for FREE

Forgot your password?
πŸ‘ Av Logo White

Enter OTP sent to

Edit

Wrong OTP.

Enter the OTP

Resend OTP

Resend OTP in 45s

πŸ‘ Popup Banner
πŸ‘ AI Popup Banner