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

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


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.3.tar.gz (493.0 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.3-py3-none-any.whl (497.8 kB view details)

Uploaded Python 3

File details

Details for the file streamlit_table_select_cell-0.3.3.tar.gz.

File metadata

File hashes

Hashes for streamlit_table_select_cell-0.3.3.tar.gz
Algorithm Hash digest
SHA256 0bb823062879622985b2cd17ed493f542a1a439b5448006523a4aad705a34de0
MD5 04cc5927c9131801b92ad6467faf2c63
BLAKE2b-256 9964a420ceeda558b4f9de2573f90b67102edb7abe5a5b8f73c56ef95e1a23b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for streamlit_table_select_cell-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 771d4cc060ff02a592f5c6aa86a39cf00148565870e13002b251ff9eb9113d45
MD5 778e850fd0e69aa47bf319495f7cf3db
BLAKE2b-256 22f9431299f55871e858052ac8ce13e7f44e73dcb59624b24f550293405ad6bb

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