Pandas Profiling for Exploratory Data Analysis

Pandas profiling is used to generate reports. This is very helpful for exploratory data analysis (EDA). You can also save the report in these formats such as HTML and JSON.

Step 1: Install Pandas Profiling

pip install pandas_profiling

If an error occurs, change the environment because this library is not compatible with some other libraries.

Step 2: Install ipywidgets

pip install ipywidgets

Step 3: Import the libraries

# Import the required libraries
import pandas_profiling as pp
import seaborn as sns

Step 4: Load Dataset

df = sns.load_dataset('tips')

Step 5: Generate Report

pp.ProfileReport(df)

Output:

Example: Save Pandas Profiling Report in HTML

# Import the required libraries
import seaborn as sns
from pandas_profiling import ProfileReport

# Load the Dataset
df = sns.load_dataset("iris")

# Cretae a Profile Report
profile = ProfileReport(df, title="Dataset Report")

# Save the report in Json format
profile.to_file("Dataset_Report.html")

Example: Save Pandas Profiling Report in JSON

# Import the required libraries
import seaborn as sns
from pandas_profiling import ProfileReport

# Load the Dataset
df = sns.load_dataset("iris")

# Cretae a Profile Report
profile = ProfileReport(df, title="Dataset Report")

# Save the report in Json format
profile.to_file("your_report.json")

If you want to learn Pandas, I recommend this book and free resource.

Leave a Comment

Your email address will not be published.