Streamlit component that allows you to select|click a cell in a table and get its rowId and columnIndex
Project description
streamlit-table-select-cell
Streamlit component that allows you to select|click a cell in a table and get its rowId and columnIndex. This is very useful when you want to dig into the detail of a cell in a pivoted dataframe.
Installation instructions
pip install streamlit-table-select-cell
Usage instructions
import streamlit as st
import pandas as pd
from st_table_select_cell import st_table_select_cell
st.subheader("Example of st_table_select_cell")
# prepare an example dataframe
data = pd.DataFrame({'Dataset':['energy','traffic','syn'], 'Test':['ehistory','snapshot','aggmax'], 'PG': [3,6,9], 'TG':[2,5,7]})
st.dataframe(data)
# show table and get user selected cell
selectedCell = st_table_select_cell(data)
st.write(selectedCell)
if selectedCell:
rowId = selectedCell['rowId']
colIndex = selectedCell['colIndex']
st.write(rowId, colIndex)
# return column name of the selected cell.
st.write(data.columns[colIndex])
# return row of the selected cell as dict.
st.write(data.iloc[int(rowId)].to_dict())
# return cell content as string.
st.write(data.iat[int(rowId), colIndex])
else:
st.write('no select')
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_table_select_cell-0.3.3.tar.gz.
File metadata
- Download URL: streamlit_table_select_cell-0.3.3.tar.gz
- Upload date:
- Size: 493.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0bb823062879622985b2cd17ed493f542a1a439b5448006523a4aad705a34de0
|
|
| MD5 |
04cc5927c9131801b92ad6467faf2c63
|
|
| BLAKE2b-256 |
9964a420ceeda558b4f9de2573f90b67102edb7abe5a5b8f73c56ef95e1a23b0
|
File details
Details for the file streamlit_table_select_cell-0.3.3-py3-none-any.whl.
File metadata
- Download URL: streamlit_table_select_cell-0.3.3-py3-none-any.whl
- Upload date:
- Size: 497.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
771d4cc060ff02a592f5c6aa86a39cf00148565870e13002b251ff9eb9113d45
|
|
| MD5 |
778e850fd0e69aa47bf319495f7cf3db
|
|
| BLAKE2b-256 |
22f9431299f55871e858052ac8ce13e7f44e73dcb59624b24f550293405ad6bb
|