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.3 - 28th September
Added
- Ability to specify filter location in display_filters(). The filters can be either displayed in sidebar, main area or columns.
- Error handling of invalid arguments in display_filters().
Changed
- Renamed filter_except() to filter_df(). The function returns a filtered df.
Deprecated
Removed
Fixed
- The StreamlitApiException that occured when selected values did not exist in the dataset.
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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 581f5bde8a3b93f8aa7a93fca02328d240b3d640eae5fde1ecfc32d1c2e6bf87 |
|
MD5 | 0249f089a08575e1d2694d7d0c93af05 |
|
BLAKE2b-256 | b4b3bec87a34c1ae5b95c6931b6df041577631ede74ee4a10368861f02bc3d0b |
Close
Hashes for streamlit_dynamic_filters-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16c1bcb14b433c815779e56ea1de923660f1d7c7beca6a58d8b3b157f9ca1766 |
|
MD5 | 34e3740cc46029971ae11760ce429a27 |
|
BLAKE2b-256 | e2caebc5a7eb315731d5bc6f1734f1292036ab17ec18812655979f3efe960460 |