Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use pandas_profiling in python

Shulou Source: shulou.com Published: 2022-06-01 18:54:45 09月13日 Update

Editor to share with you how to use pandas_profiling in python. I hope you will get something after reading this article. Let's discuss it together.

Full picture of the analysis report

What is exploratory data analysis?

Children's shoes who are familiar with pandas probably know the describe () and info () functions of pandas, which are used to view the overall situation of the data, such as average, standard deviation, and so on, which is the so-called exploratory data analysis-EDA.

Introduction to pandas_profiling

If you want to get the full picture of the data more easily and quickly, weeping recommends a python library: pandas_profiling, which only needs one line of code to generate data EDA reports.

Pandas_profiling is based on the DataFrame data type of pandas and can be used for exploratory data analysis simply and quickly.

For each column of the dataset, pandas_profiling provides the following statistics:

1. Summary: data type, unique value, missing value, memory size

2. Quantile statistics: minimum, maximum, median, Q1, Q3, maximum, range, quartile

3. Descriptive statistics: mean, mode, standard deviation, absolute median deviation, coefficient of variation, peak, skewness coefficient

4. The most frequent value, histogram / histogram

5. Visualization of correlation analysis: highlight strongly correlated variables, Spearman, Pearson matrix correlation color scale diagrams

And this report can be exported as HTML, which is very easy to view.

Pandas_profiling installation

Install pandas_profiling can be installed using pip, conda or download files, which is very convenient.

I use the pip method here by typing:

Pip install pandas-profiling

This article carries on the code experiment in Jupyter notebook.

How to use pandas_profiling

1. Load the dataset

I use the classic Titanic data set here:

# Import related library import seaborn as snsimport pandas as pdimport pandas_profiling as ppimport matplotlib.pyplot as plt# to load Titanic dataset data = sns.load_dataset ('titanic') data.head ()

Output:

2. Use pandas_profiling to generate data exploration report

Report = pp.ProfileReport (data) report

Output report:

3. Export to html file

Report.to_file ('report.html') has finished reading this article. I believe you have some understanding of "how to use pandas_profiling in python". If you want to know more about it, please follow the industry information channel. Thank you for reading!

Tags: Data report analysis exploratory data analysis statistics maximum code panorama file maximum standard relevance article type coefficient Titanic generation output minimum Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Linux Apple Shulou Information vpn