DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

SBOMs are essential to circumventing software supply chain attacks, and they provide visibility into various software components.

Related

  • Data Analytics Using Python
  • BigQuery DataFrames in Python
  • Unleash Peak Performance in Java Applications: Overview of Profile-Guided Optimization (PGO)
  • Optimization of I/O Workloads by Profiling in Python

Trending

  • Seata the Deal: No More Distributed Transaction Nightmares Across (Spring Boot) Microservices
  • A Software Engineer’s Guide to Thrive in Gen AI Era: Master It or Fade Out
  • Modernizing Apache Spark Applications With GenAI: Migrating From Java to Scala
  • Top NoSQL Databases and Use Cases
  1. DZone
  2. Data Engineering
  3. Data
  4. Pandas One Line Magical Code for EDA: Pandas Profile Report

Pandas One Line Magical Code for EDA: Pandas Profile Report

A developer gives a quick tutorial on how to use Python and the pandas-profiling package to perform analyses on large data sets.

By 
Sunil Kappal user avatar
Sunil Kappal
·
Jul. 08, 19 · Tutorial
Likes (1)
Comment
Save
Tweet
Share
31.8K Views

Join the DZone community and get the full member experience.

Join For Free

For a lot of us, EDA may simply mean going deep into the data and finding some initial patterns and trends within the underlying data. It may also mean establishing correlations between variables to curate some interesting insights.

However, one thing that we as data analytics practioners cannot afford to overlook, which can potentially turn our data munging aspirations into an awry nightmare, is data hygiene or data quality. Therefore, in my opinion, data quality, description, shape, patterns, and relationships completes the EDA cycle.

Let's look at the EDA process from the perspective of various Python commands that not only showcase the level of effort but also indicates the level of complexity, when compared to a single line of code, i.e. pandas_profiling.ProfileReport() which makes data profiling and EDA process a breeze.

EDA process from the perspective of various Python commands

The pandas-profiling Python package is a great tool to create HTML profiling reports. For a given dataset, it computes the following statistics:

  • Essentials: type, unique values, missing values.
  • Quantile statistics like minimum value, Q1, median, Q3, maximum, range, interquartile range.
  • Descriptive statistics like mean, mode, standard deviation, sum, median absolute deviation, coefficient of variation, kurtosis, skewness.
  • Most frequent values.
  • Histogram.
  • Correlations highlighting of highly correlated variables, Spearman and Pearson matrixes.

Prerequisites:

  • Install Python and Jupyter Notebook
  • Install the pandas-profiling module

How to Use the pandas-profiling Package on a Dummy Data Set

After creating a new notebook (I am using a Google colab environment to run all the Python modules and libraries), we need to:

  1. Load Pandas and Pandas Profiling
    • import pandas as pd
    • import pandas_profiling
  2. Load data into a data frame

Load data into a data frame

3. Run pandas-profile's report command:

4. Display the data profiling report:

The above is just the snapshot - there is more to this report!

You can view the complete EDA analysis on my GitHub Page.

The users can also export this report to the HTML format and can share with a larger audience.

Data profiling is the systematic up front analysis of the content of a data source, all the way from counting the bytes and checking cardinalities up to the most thoughtful diagnosis of whether the data can meet the high level goals of the data warehouse. -   Ralph Kimball

You can refer more about this module here on GitHub.

Pandas Data (computing) Data profiling Profile (engineering)

Published at DZone with permission of Sunil Kappal, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Data Analytics Using Python
  • BigQuery DataFrames in Python
  • Unleash Peak Performance in Java Applications: Overview of Profile-Guided Optimization (PGO)
  • Optimization of I/O Workloads by Profiling in Python

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • [email protected]

Let's be friends: