Including Pandas Profiling Report in Streamlit

Q1)How to add the pandas profile report and other charts in the streamlit?
As I am starting to explore the streamlit, I have tried this in my editor and got nothing as an output to the pandas profiling report.
How do I add the profiling report ?
Where Can I find the full documentation of all the widgets and controls one can add in streamlit?
Here is my code:

import streamlit as st
import pandas as pd
import pandas_profiling as pf
DATE_COLUMN = 'date/time'
DATA_URL = (''

def load_data(nrows):
    data = pd.read_csv(DATA_URL, nrows=nrows)
    def lowercase(x): return str(x).lower()
    data.rename(lowercase, axis='columns', inplace=True)
    data[DATE_COLUMN] = pd.to_datetime(data[DATE_COLUMN])
    return data

data = load_data(100)
st.subheader('Raw Data')
x = st.slider('x')
st.write(x, 'Squared is :', x*x)
selectbox_label = st.selectbox('Filter to :', ['lat', 'lon'])
selected_columns = selectbox_label
report = pf.ProfileReport(data)
1 Like

Hi @AVI18794

I took a look at it It should be doable as the report can be output in HTML

If you combine this with the ability to write html in markdown

You should be able to create something.

I would also like to create such a thing but i cannot get pandas-profilling to work. I experience the issue reported here

Good luck :slight_smile:

1 Like

Well, I wanted to do the same thing as @AVI18794 wanted to

And I tested the @Marc’s advise and modified as the following

profile = df.profile_report()
st.write(profile.html, unsafe_allow_html = True)

However, the result is not that so perfect as using in Jupyter Notebook.

streamlit’ result

Juypter Notebook result

Is there other solution to display pandas profiling in streamlit?

1 Like

Hi @AVI18794 and @jimmy60805

This Pandas Profiling module is awesome! I wasn’t aware of its existence — thanks for sharing it :smiley:

I don’t see a way to show Pandas profiles in Streamlit today, except for the imperfect solution y’all already discovered. The reason for this is that we don’t support passing raw HTML to your app, for security reasons. With raw HTML it would be very easy for malicious code to do things like steal data from the app and send it to an external server. Or steal some credential of yours. And so on.

So we ask users to let us know whenever they hit a road-block like this, so we can implement a secure solution for them.

In this specific case, I think we should just implement support for Pandas profile reports! So I created a feature request for it here. Please subscribe to the linked Github issue to follow up on any progress we make there.


Hi @thiago

Thanks your reply!!!

Wait for your improvement for supporting Pandas-Profiles and thank for all your efforts in developing streamlit :grin:


By running this:
st.markdown(profile.to_html(), unsafe_allow_html=True)


I actually get parsing error.

Error parsing Markdown or HTML in this string:

<!doctype html><meta name=description content="Profile report generated with the


Hello all,

I was facing the same issue, till i found out a solution.

check here:

Hi guys,
I just started to use Streamlit. I also wanted to use Pandas Profiling to my project. I came to this question, and I solved it.

You need st.components.v1.html to do so:

import pandas-profiling as pp
import streamlit as st
import streamlit.components.v1 as components

df = pd.read_csv()...
report = pp.ProfileReprot(df, title="...").to_html()
components.html(report, height=..., width=...)

Good luck!


Hey @minhlong94,

This is indeed an easy way to render pandas profiling report :smiley:

However I personally had issues with height that doesn’t auto updates. With widgets that can expand, you might either have a height which is too short when widgets are expanded, or a blank area at the bottom of your page when they’re not.

If you come across this problem, my component handles the issue: Pandas Profiling

Hi @synode,
Thank for your comment. Yes I did use your repo initially, but then I had a side problem: the Profile Report was too long, but your repo did not have an option to enable scrolling, so I ended up using st components.
Should I make that a feature request?

1 Like

Oh I see. Please do! I’ll add a new height parameter soon.

Hello @minhlong94,

A new height parameter was added in release 0.1.1.