question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for Pandas Profiling module

See original GitHub issue

Feature description

We’re like to be able to do this:

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)

# Get profile report 
report = pf.ProfileReport(data)

# 👇Show report in Streamlit app! (This is what we want to implement)
st.write(report)

…which should give you something like this:

image

More info on pandas_profiling here: https://towardsdatascience.com/a-better-eda-with-pandas-profiling-e842a00e1136

Implementation details

The report object in the script above actually has a report.html attribute that we’d be tempted to use for this. However, that’s a bad idea! This would mean we’d be sending raw HTML over the wire and loading it unsafely via innerHTML.

So before implementing this we need to do a little research…

One possibility: serve it in an iframe. See #686 for related work.

Related discussions

https://discuss.streamlit.io/t/including-pandas-profiling-report-in-streamlit/473/4

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:12
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
sbrugmancommented, May 3, 2020

Pandas-Profiling author here. Pandas-Profiling supports multiple user interfaces (HTML report, CLI, Jupyter Notebook/Lab Widgets and PyQt application).

I’d like to invite interested users/developer to contribute a streamlit interface. It can be based on the Jupyter interface and shouldn’t be much work. The relevant code can be found here.

For first-time contributors: don’t worry about it not being perfect at first. We will do a code review from the Pull Request and take it from there.

1reaction
MarcSkovMadsencommented, Jun 6, 2020

I just created an example in Panel using the Pandas Profiling .to_html method and an iframe.

I think you can find the necessary inspiration there.

See

pandas_profiling_small

Read more comments on GitHub >

github_iconTop Results From Across the Web

pandas-profiling - PyPI
pandas -profiling generates profile reports from a pandas DataFrame . The pandas df.describe() function is handy yet a little basic for exploratory data ......
Read more >
Learn How to Use Python's Pandas Profiling Library | Zuar
Import pandas; Import ProfileReport from the pandas_profiling library; Create a DataFrame using the data you wish to report; Use ProfileReport() ...
Read more >
Installation — pandas-profiling dev documentation - YData
A new conda environment containing the module can be created via: conda env create -n pandas-profiling conda activate pandas-profiling conda install -c ...
Read more >
python 3.x - Unable to import Pandas Profiling - Stack Overflow
Go to CMD & then type python -m pip install pandas-profiling · Go to CMD & conda install -c conda-forge pandas-profiling=2.6.0 · import...
Read more >
How to use Pandas-Profiling on Google Colab | by Aishah Ismail
STEPS : Install Pandas Profiling on Google Colab. · 1. Run the below command, you can visit the link on github. · 2....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found