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.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking âAccept allâ, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.