Home Tools Data Visualization Robust Exploratory Data Analysis using Sweetviz

Robust Exploratory Data Analysis using Sweetviz [ Only Two Lines of Code]


In this guide, I will show you robust Exploratory Data Analysis (EDA) using Sweetviz.  Exploratory data analysis is a process for analyzing data sets to get insights from data. It lets you summarize their important characteristics using visual methods.

This open source library was created by Francois Bertrand and few contributors. This package will help you to visualize your datasets in no-time.


One may wonder how to get started after collecting a dataset. EDA lets you discover data types, missing information, correlations, etc. In addition, we can also create insightful visualization to kickstart EDA.

During this process, we have to do the same work repeatedly to characterize a dataset. Sweetviz can solve such types of repetitive works. Target analysis, compare dataset, type inference, etc. are the main features of this library.

Here, we have provided everything that you need for starting a robust exploratory data analysis. So, you bookmark this short guide.

Prerequisites For Sweetviz

  1. Install Anaconda Distribution

2. Jupyter Notebook for coding

3. Install and Import Sweetviz package

Install Sweetviz for Robust Exploratory Data Analysis

Lets get started

Step 1: Installation

All you need to do is download the sweetviz library from here. This library works on Windows, macOS, and Linux.

Now, you install this package using pip command. Type the code and then press ENTER.

pip install sweetviz

Once the code executes, you will see this screenshot of the installation.

Installation sweetviz for robust exploratory data analysis
Sweetviz Library Installation

Step 2: Dataset Collection

After installation, you need to import sweetviz to work with the dataset. You also load the train and test datasets.

We shall be using the dataset (House Prices: Advanced Regression Techniques) from the Kaggle.

Here the problem statement is to analyze the “SalePrice” of the dataset.

Step 3: Import Library

Once you collect the dataset, then type the codes in a notebook and then press Run.

Import Sweetviz Package for Exploratory Data analysis
Import Sweetviz Package

Step 4: Verify Dataset

Now, we will identify the number of rows and columns in the train dataset using the following code:

Train Dataset with Rows and Columns for Sweetviz
Train Dataset Details

Step 5: Generating Report

We are going to create the report using the analyze() function.

You can also use compare_intra() and compare() function for the same purpose. Now, we will use the analyze() function to display the report.

Creating Association Graph using Sweetviz for Exploratory Data Analysis
Association Graph ( Analyzing sale Price)

We ran the below function show_html to save the report.

 Generating Report From the Datasets
Code for Generating Report

Step 6: Final Report

You will get the report in your default web browser like this.

Final Report of Robust Exploratory Data Analysis using sweetviz only Two lines of Code
Final Report

Conclusion: Robust Exploratory Data Analysis

Well, now is the best time to start exploratory data analysis. The above steps are all you need to visualize your datasets.

In case if you wish to add any information, feel free to let me know in the comment section below.

For more details:

Powerful EDA using Sweetviz- Click Here

Sweetviz on the Github – Click Here

Do share this short guide with others who wanted to visualize data smoothly for some time.

Dr. Ujjal Marjit, PhDhttps://researcherssite.com
Dr. Ujjal Marjit leads the Centre for Information Resource Management of the University of Kalyani, India. He received his bachelor honours degree from Visva Bharati, Central University and Master in Computer Application from Jadavpur University, India.He did his BLISc and MLISc from Madurai Kamraj University, India. He obtained his PhD in Computer Science and Engineering from University of Kalyani. He was also a visiting researcher at Norwegian University of Science and Technology (NTNU), Norway. Dr. Marjit was a member of the Association for Computing Machinery (ACM), USA. He has coauthored several book chapters and over 70 research publications in various International Journals and Conferences. Dr. Marjit attended many national and international conferences in India and abroad ( Germany, London, Finland, Norway, Netherlands). He has been working in University since 2001.


Please enter your comment!
Please enter your name here

Most Popular

Useful Tool for Identifying Predatory Journals

In this post, I show you how to identify predatory journals using the "Compass to Publish", a useful tool.

Must-Have Browser Extensions for Academic Research

In this article, I share some must have browser extensions for academic research in any domain.

How to Make Your Academic Research Paper Open Access, for Free

This article describes how to make your academic research paper open access, for free using shareyourpaper.org tool

How to Find Relevant Research Papers to Speed Up Your Literature Review

How to Find the Relevant Academic Literature to Speed Up Literature Review Using the Inciteful Tool