Dynamic multiselect filters for Streamlit
Project description
Custom component to create dynamic multiselect filters in Streamlit. The filters apply to a dataframe and adjust their values based on the user selection (similar to Google Sheets slicers or Only Relevant Values in Tableau).
Sample usage:
import streamlit as st
from streamlit_dynamic_filters import DynamicFilters
data = {
'Region': ['North America', 'North America', 'North America', 'Europe', 'Europe', 'Asia', 'Asia'],
'Country': ['USA', 'USA', 'Canada', 'Germany', 'France', 'Japan', 'China'],
'City': ['New York', 'Los Angeles', 'Toronto', 'Berlin', 'Paris', 'Tokyo', 'Beijing']
}
df = pd.DataFrame(data)
dynamic_filters = DynamicFilters(df, filters=['Region', 'Country', 'City'])
with st.sidebar:
dynamic_filters.display_filters()
dynamic_filters.display_df()
Demo GIF:
0.1.4 - 4th December 2023
Added
- **kwargs to display_df() to allows passing parameters that st.dataframe() supports like use_container_width, hide_index etc. (contribution of c-bik)
Deprecated
- replaced st.experimental_rerun with st.rerun.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for streamlit_dynamic_filters-0.1.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a70fb0454124178667236e634a5531ffc1e0b692f62396998651d249467b9a50 |
|
MD5 | 4318a798365617b0ed15489a07a2c8f8 |
|
BLAKE2b-256 | bf9ba2f7579b744014f937044663b6c9ebd3a68d4aac37597dd3b3b16a1d7662 |
Close
Hashes for streamlit_dynamic_filters-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b59583cac4c7b043b2a5f3679ebf7951a1856df53c6475f5e32a5406758da5d |
|
MD5 | 59bfe9bd982adaf72885d0b19d3d80ef |
|
BLAKE2b-256 | 10e4ea76f093013f790a7e9ac5d462bc6acae28a97c681043f6b114639fa2ffc |