clickable tables in python streamlit

Solutions on MaxInterview for clickable tables in python streamlit by the best coders in the world

showing results for - "clickable tables in python streamlit"
Mathilda
21 Jun 2019
1import streamlit as st
2import numpy as np
3import pandas as pd
4
5# Randomly fill a dataframe and cache it
6@st.cache(allow_output_mutation=True)
7def get_dataframe():
8    return pd.DataFrame(
9        np.random.randn(50, 20),
10        columns=('col %d' % i for i in range(20)))
11
12
13df = get_dataframe()
14
15# Create row, column, and value inputs
16row = st.number_input('row', max_value=df.shape[0])
17col = st.number_input('column', max_value=df.shape[1])
18value = st.number_input('value')
19
20# Change the entry at (row, col) to the given value
21df.values[row][col] = value
22
23# And display the result!
24st.dataframe(df)
25