# Exploratory Data analysis using pandas profiling

Hello everyone, 

In this article, we are going to explore how to perform exploratory data analysis using an open-source python module called **pandas-profiling**. 

Usually analyzing a dataset or preparing a data report of a data set would be a tiring process. starting with producing numeric analysis to map analysis there is a lot of work to do. But let's see how to perform EDA with simple steps using pandas-profiling.

First of all, let us see

# WHAT IS EDA - EXPLORATORY DATA ANALYSIS


let's say you want to buy a car 🏎, before buying you will see a review of various cars online and consider various aspects like brand, mileage, durability, etc... then you will analyze what to buy and what not to buy from the data you have collected. likewise, before training an ML model we would do an analysis of the dataset, basically to reduce redundancy and anomalies if any and to have an overview of the dataset. That analysis is called exploratory data analysis(EDA).

> 
Exploratory Data Analysis refers to the critical process of performing initial investigations on data so as to discover patterns, spot anomalies, test hypotheses, and check assumptions with the help of summary statistics and graphical representations.

so it is better to perform exploratory data analysis before training a model for production purposes so that you will get a better understanding of the data you are working on.

## PANDAS-PROFILING

Pandas profiling is an open-source Python module with which we can quickly do an exploratory data analysis with just a few lines of code. it also generates interactive reports in a web format that can be presented to any person, even if they don’t know to program them.

In short, what pandas profiling does is save us all the work of visualizing and understanding the distribution of each variable. It generates a report with all the information easily available.

Lets us get to code,

I use Jupyter notebook and I would recommend using it. Other environments like google collab sometimes don't support every feature provided by pandas-profiling.

the first step is to install the dependencies


```
pip install pandas-profiling
``` 
I hope you have installed pandas and NumPy already. if not install them too.


```
import pandas as pd
import numpy as np
``` 


```
from pandas_profiling import ProfileReport
``` 

download any dataset from [kaggle](https://www.kaggle.com/datasets).


```
dta = pd.read_csv("file-name.csv")
``` 


```
//to check if the dataset is loaded
dta.shape
dta.head()
``` 



```
//to create a report
profile = ProfileReport(dta, 'Pandas profiling report', explorative = True) 

```

```
//, at last, performs the above code and run the cell
profile
``` 


![Screenshot 2021-12-02 at 11.48.05 AM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1638867199853/r9vZf0Y4x.png)

 There will be a report generated by pandas-profiling.


![Screenshot 2021-12-02 at 11.48.52 AM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1638867255846/rTWWWPLwH.png)


![Screenshot 2021-12-02 at 11.50.04 AM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1638867297692/VKi_tfMYi.png)

![Screenshot 2021-12-02 at 11.50.18 AM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1638867338260/d25HXOj-M.png)


![Screenshot 2021-12-02 at 11.50.34 AM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1638867353823/1jPNtKXtH.png)


![Screenshot 2021-12-02 at 11.50.50 AM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1638867375384/y-7zqLEcd.png)

 
![Screenshot 2021-12-02 at 11.51.01 AM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1638867392496/mNN1tm-Kb.png)

![Screenshot 2021-12-02 at 11.51.10 AM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1638867425460/Y68vfNIq2.png)

![Screenshot 2021-12-02 at 11.51.19 AM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1638867447949/ux7SDDqu6.png)

![Screenshot 2021-12-02 at 11.51.29 AM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1638867460315/yFi23MZjE.png)

![Screenshot 2021-12-02 at 11.51.40 AM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1638867488066/LptwB9xxA.png)

![Screenshot 2021-12-02 at 11.51.46 AM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1638867504436/mFNwhju4K.png)

![Screenshot 2021-12-02 at 11.51.52 AM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1638867518293/TeauRPwl-.png)

![Screenshot 2021-12-02 at 11.52.00 AM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1638867530372/waMVcc0MZ.png)

![Screenshot 2021-12-02 at 11.52.06 AM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1638867542457/2PxNmqPV4.png)

![Screenshot 2021-12-02 at 11.52.19 AM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1638867571059/IeTAOv1qQw.png)

![Screenshot 2021-12-02 at 11.52.26 AM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1638867579744/56hjIqbks.png)

![Screenshot 2021-12-02 at 11.52.31 AM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1638867588142/tZ60y-aKQ.png)

![Screenshot 2021-12-02 at 11.52.41 AM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1638867604459/DzCNf3d86.png)

![Screenshot 2021-12-02 at 11.52.53 AM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1638867613387/NXW4OQtct.png)

you can export the report in .html form, where it can be shared with anybody easily.

```
profile.to_file("any_name.html")
``` 
the file will be stored in the directory you store your notebook

![Screenshot 2021-12-02 at 11.53.03 AM.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1638867620319/xTIQzZrBY.png)

# OUTRO:

I hope you have learned something new and efficient. like pandas-profiling there are quite a few modules in python like sweetviz, D-Tale, which make our lives easier to perform exploratory data analysis, especially for huge datasets.

related sources:

%[https://towardsdatascience.com/exploratory-data-analysis-with-pandas-profiling-de3aae2ddff3]


%[https://towardsdatascience.com/exploratory-data-analysis-8fc1cb20fd15]

Thank you for reading 😊

*HAPPY LEARNING
*

*-JHA*





