Generate Reports Using Pandas Profiling in Python
Here, we will learn how to generate reports using Pandas Profiling in Python.
Basics you need to know:
Open the terminal and install pandas_profiling
using pip.
Write the following command in your terminal and press enter to install this package.
pip install pandas_profiling
Now, as the package as has been installed, write the code as instructed.
You should know how to import pandas and ProfileReport.
import pandas as pd from pandas_profiling import ProfileReport
We will be using ProfileReport
for this purpose from the pandas_profiling
package in python.
Then, you should know how to make a dataframe using data you are willing to make a report of.
data = [['riddhi', 20,'Delhi'], ['Ria', 25,'Goa'], ['Rita', 24,'Chennai']] df=pd.DataFrame(data,columns=['Name','Roll no.','City'])
print(df)
Printing the data frame will give the following output:
Creating the report:
INPUT:
All you need to do is pass the dataframe in ProfileReport(__)
as shown below.
profile = ProfileReport(df) profile
OUTPUT:
You will get to see the following output.
The overview has been shown above.
Variables, Correlations, Missing values, Sample will also be shown along with it. You can click on the top-left corner to directly go to any one of them in your output.
Leave a Reply