A streamlit search helper tool package
Project description
🔍 Streamlit Awesome Search
Streamlit Awesome Search is a component for the Streamlit library. It allows users to load a Pandas DataFrame and automatically generate Streamlit widgets in the expander. In addition, it also supports customization of search fields. These widgets trigger filtering events within the Pandas DataFrame.
🖊️ Support
Current support only exists for DataFrame columns with strings, numbers (int64 and float64) and datetimes(datetime64). A future update will include support for advanced search function.
By default, string data generates a text_input Streamlit widget, while numerical data creates sliders and datetime data creates date_input 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 column widget type dict:
custom_column_widget_type = {"Name": "text",
"Sex": "multiselect",
"Embarked": "multiselect",
"Ticket": "text",
"loginDate": "date_input"
"Pclass": "multiselect"}
The current version only supports: text, multiselect, date_input and select.
🚧 Installation
- First, install Streamlit
pip install streamlit
- Next, intall Pandas
pip install pandas
- Install Streamlit Awesome Search
pip install streamlit-awesome-search
💻 Useage
import streamlit as st
import pandas as pd
import streamlit-awesome-search.awesome_pandas as apd
@st.cache_data
def load_data():
titan_df = pd.read_csv(file)
return titan_df
file = "data/sample.csv"
df = load_data().astype({'loginDate': 'datetime64[s]'})
st.markdown("# Source Dataframe")
st.dataframe(df)
all_widgets = apd.create_widgets_expander(df, custom_column_widget_type={'loginDate':'date_input'})
if all_widgets:
with st.spinner('Searching ...'):
filter_df = apd.filter_df(df, all_widgets)
st.markdown("# Result Dataframe")
st.dataframe(filter_df)
This will generate the following app:
🤗 Want to support my work?
Please give me a free little star, this will be the motivation for me to keep updating.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file streamlit-awesome-search-0.1.1.tar.gz.
File metadata
- Download URL: streamlit-awesome-search-0.1.1.tar.gz
- Upload date:
- Size: 16.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32d5223918c5dfbb4969c508626b4faeaec81f4432567e9332f1e1d265f58e11
|
|
| MD5 |
bf02a323dc8f873a02500b2778c7a9f5
|
|
| BLAKE2b-256 |
9d0295a5185ee9f0cd4d42e5b6ad5805c7fcb0bb161642959727bfd4ecf919bc
|
File details
Details for the file streamlit_awesome_search-0.1.1-py3-none-any.whl.
File metadata
- Download URL: streamlit_awesome_search-0.1.1-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61ad4da8e23948fd1650dc754c32414574160a77815211170737c23403df3492
|
|
| MD5 |
fcd7f3572fb147a2478377e3d0395e2b
|
|
| BLAKE2b-256 |
f1f386c4af0fcee2af303df447e8e4a094c0ed6f8ed2e48369e47639011f5be8
|