Name | streamlit-pandas JSON |
Version |
0.0.8
JSON |
| download |
home_page | |
Summary | Create a Streamlit Pandas App |
upload_time | 2022-12-08 14:54:59 |
maintainer | |
docs_url | None |
author | WJB Mattingly |
requires_python | |
license | |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
![Streamlit pandas logo](https://github.com/wjbmattingly/streamlit-pandas/raw/main/images/streamlit-pandas-logo-blue.png)
# Streamlit Pandas
Streamlit Pandas is a component for the [Streamlit](https://streamlit.io/) 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:
```python
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
```python
pip install streamlit
```
2. Next, install Pandas
```python
pip install pandas
```
3. Install Streamlit Pandas
```python
pip install streamlit-pandas
```
# Usage
```python
import streamlit as st
import pandas as pd
import streamlit_pandas as sp
@st.cache(allow_output_mutation=True)
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](https://github.com/wjbmattingly/streamlit-pandas/raw/main/images/streamlit-pandas-app.jpg)
Raw data
{
"_id": null,
"home_page": "",
"name": "streamlit-pandas",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "WJB Mattingly",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/10/5f/5f614c4aa6997c20dedd4014a0e2f3ff8207c7b8d150b77a6fb8febf156a/streamlit_pandas-0.0.8.tar.gz",
"platform": null,
"description": "![Streamlit pandas logo](https://github.com/wjbmattingly/streamlit-pandas/raw/main/images/streamlit-pandas-logo-blue.png)\n\n# Streamlit Pandas\nStreamlit Pandas is a component for the [Streamlit](https://streamlit.io/) 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.\n\n# Support\nCurrent support only exists for DataFrame columns with strings and numbers (int64 and float64). A future update will include support for time-series data.\n\nBy 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.\n\nSample of a custom dictionary:\n\n```python\ncreate_data = {\"Name\": \"text\",\n \"Sex\": \"multiselect\",\n \"Embarked\": \"multiselect\",\n \"Ticket\": \"text\",\n \"Pclass\": \"multiselect\"}\n```\nThe current version only supports: text, multiselect, and select.\n\n# Installation\n1. First, install Streamlit\n```python\npip install streamlit\n```\n2. Next, install Pandas\n```python\npip install pandas\n```\n3. Install Streamlit Pandas\n```python\npip install streamlit-pandas\n```\n\n# Usage\n```python\nimport streamlit as st\nimport pandas as pd\nimport streamlit_pandas as sp\n\n@st.cache(allow_output_mutation=True)\ndef load_data():\n df = pd.read_csv(file)\n return df\n\nfile = \"../data/titanic.csv\"\ndf = load_data()\ncreate_data = {\"Name\": \"text\",\n \"Sex\": \"multiselect\",\n \"Embarked\": \"multiselect\",\n \"Ticket\": \"text\",\n \"Pclass\": \"multiselect\"}\n\nall_widgets = sp.create_widgets(df, create_data, ignore_columns=[\"PassengerId\"])\nres = sp.filter_df(df, all_widgets)\nst.title(\"Streamlit AutoPandas\")\nst.header(\"Original DataFrame\")\nst.write(df)\n\nst.header(\"Result DataFrame\")\nst.write(res)\n```\nThis will generate the following application:\n\n![Streamlit-Pandas demo application](https://github.com/wjbmattingly/streamlit-pandas/raw/main/images/streamlit-pandas-app.jpg)\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "Create a Streamlit Pandas App",
"version": "0.0.8",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "d8c364d4efba8259c3142c92696a2580",
"sha256": "e2906b17bbf450738b5f4e6e2cbbaaa7a9d5ddd93671201b4de22bee22ab058b"
},
"downloads": -1,
"filename": "streamlit_pandas-0.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d8c364d4efba8259c3142c92696a2580",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 3491,
"upload_time": "2022-12-08T14:54:57",
"upload_time_iso_8601": "2022-12-08T14:54:57.820688Z",
"url": "https://files.pythonhosted.org/packages/b5/6d/c15a5476a37692e9ffd818f1ab7a8976d0828fff3f1ad9fd3b90355055ee/streamlit_pandas-0.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "17e89b91805c25b0ddd1dbbd56138810",
"sha256": "a951c276fa06d2172ed956b8d313be9ed9cac6dec299c69fbe1f042f46f944f7"
},
"downloads": -1,
"filename": "streamlit_pandas-0.0.8.tar.gz",
"has_sig": false,
"md5_digest": "17e89b91805c25b0ddd1dbbd56138810",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3122,
"upload_time": "2022-12-08T14:54:59",
"upload_time_iso_8601": "2022-12-08T14:54:59.470252Z",
"url": "https://files.pythonhosted.org/packages/10/5f/5f614c4aa6997c20dedd4014a0e2f3ff8207c7b8d150b77a6fb8febf156a/streamlit_pandas-0.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-08 14:54:59",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "streamlit-pandas"
}