Skip to main content

Streamlit pandas logo

Streamlit Pandas

Streamlit Pandas is a component for the Streamlit library. It allows users to load a Pandas DataFrame and automatically generate Streamlit widgets in the sidebar. These widgets trigger filtering events within the Pandas DataFrame.

Support

Current support only exists for DataFrame columns with strings and numbers (int64 and float64). A future update will include support for time-series data.

By default, string data generates a text_input Streamlit widget, while numerical data creates sliders with ranges preset to the minimum and maximum values for that column. Users can pass a custom dictionary for handling specific types of data, where each key is the column in the DataFrame and the value is the streamlit widget type.

Sample of a custom dictionary:

create_data = {"Name": "text",
                "Sex": "multiselect",
                "Embarked": "multiselect",
                "Ticket": "text",
                "Pclass": "multiselect"}

The current version only supports: text, multiselect, and select.

Installation

  1. First, install Streamlit
pip install streamlit
  1. Next, install Pandas
pip install pandas
  1. Install Streamlit Pandas
pip install streamlit-pandas

Usage

import streamlit as st
import pandas as pd
import streamlit_pandas as sp

@st.cache_data
def load_data():
    df = pd.read_csv(file)
    return df

file = "../data/titanic.csv"
df = load_data()
create_data = {"Name": "text",
                "Sex": "multiselect",
                "Embarked": "multiselect",
                "Ticket": "text",
                "Pclass": "multiselect"}

all_widgets = sp.create_widgets(df, create_data, ignore_columns=["PassengerId"])
res = sp.filter_df(df, all_widgets)
st.title("Streamlit AutoPandas")
st.header("Original DataFrame")
st.write(df)

st.header("Result DataFrame")
st.write(res)

This will generate the following application:

Streamlit-Pandas demo application

Metadata

Release files for streamlit-pandas 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for streamlit-pandas 0.0.9
File Size Uploaded
streamlit_pandas-0.0.9.tar.gz 3.1 kB Details

Release files / streamlit_pandas-0.0.9.tar.gz

Download URL streamlit_pandas-0.0.9.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
64c961addcdc400d338ee3dfec69a880eedf8451f4eaa299339644ba50789fbf
BLAKE2b-256 checksum
How to use checksums
dbdcafe3ab497d13d77316d87f0f2b893ec26b085d05ebadee31ddbe647c3592
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.6

Release history Release notifications | RSS feed

This release

0.0.9 This release

1 release file

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page