Skip to main content

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

Example

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")

data = pd.DataFrame({'Dataset':['energy','traffic','syn'], 'Test':['ehistory','snapshot','aggmax'], 'PG': [3,6,9], 'TG':[2,5,7]})
st.dataframe(data)

selectedCell = st_table_select_cell(data)
st.write(selectedCell)

if selectedCell:
    rowId = selectedCell['rowId']
    colIndex = selectedCell['colIndex']
    st.info('cell "{}" selected at row {} and col {} ({})'.format(
        data.iat[int(rowId), colIndex], rowId, colIndex, data.columns[colIndex]))
    st.write('selected row data: ', data.iloc[int(rowId)].to_dict())
else:
    st.warning('no select')

Notes

version 0.3.3 only compatible with streamlit 1.30.0 version 0.3.4 is tested and compatible with streamlit 1.37.0 or higher

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

streamlit-table-select-cell-0.3.4.tar.gz (492.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

streamlit_table_select_cell-0.3.4-py3-none-any.whl (1.5 MB view details)

Uploaded Python 3

File details

Details for the file streamlit-table-select-cell-0.3.4.tar.gz.

File metadata

File hashes

Hashes for streamlit-table-select-cell-0.3.4.tar.gz
Algorithm Hash digest
SHA256 00f68ab47e874bce5625b737fa29ad06fbfa4be43c8564657374172ba65d47f1
MD5 41b05cc12639e9c768bd0d22dfd7da1b
BLAKE2b-256 6ff3c9305650bdb9256958088fd3b2a92ce27637ca39ee4d8fbf1166c07bfab7

See more details on using hashes here.

File details

Details for the file streamlit_table_select_cell-0.3.4-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_table_select_cell-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7a45ad8aa5314fba87a98b18c32f8619ddd243aa0f3098cc5641bbacf25a27e9
MD5 bed1fb08ee3d6a75cce9ad3cda374748
BLAKE2b-256 6981753fb06dc5770fb5d9d7dba643f9fa9a7202c157ad1c64570f1e4dcee1f8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page