使用Python在Pandas中进行数据分析
Pandas是最流行的Python库之一,主要用于数据处理和分析。当我们在处理大量数据时,很多时候我们需要进行探索性数据分析。我们需要获得关于不同列的详细描述,以及它们之间的关系,空值检查,数据类型,缺失值等。因此,Pandas profiling是一个Python模块,只需几行代码就能完成EDA并给出详细的描述。
安装:
pip install pandas-profiling
示例:
#import the packages
import pandas as pd
import pandas_profiling
# read the file
df = pd.read_csv('Geeks.csv')
# run the profile report
profile = df.profile_report(title='Pandas Profiling Report')
# save the report as html file
profile.to_file(output_file="pandas_profiling1.html")
# save the report as json file
profile.to_file(output_file="pandas_profiling2.json")
输出:
HTML File:
JSON File: