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 = ('https://s3-us-west-2.amazonaws.com/'
'streamlit-demo-data/uber-raw-data-sep14.csv.gz')
@st.cache
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')
st.write(data)
x = st.slider('x')
st.write(x, 'Squared is :', x*x)
selectbox_label = st.selectbox('Filter to :', ['lat', 'lon'])
selected_columns = selectbox_label
st.write(data[selected_columns])
report = pf.ProfileReport(data)
st.write(report)
This Pandas Profiling module is awesome! I wasn’t aware of its existence — thanks for sharing it
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.
This is indeed an easy way to render pandas profiling report
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 @okld,
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?
Hello @Mahima-ai, indeed I could use this option, but my motivation was to avoid using it and get a seamless integration of profile reports in my apps. Of course if that doesn’t bother you, fixing your own height and using scrolling=True if perfectly fine.