learn-streamlit / app.py
dengkane's picture
Create app.py
69881c2
raw
history blame
1.12 kB
import streamlit as st
# To make things easier later, we're also importing numpy and pandas for
# working with sample data.
import numpy as np
import pandas as pd
st.title('My first app')
st.write("Here's our first attempt at using data to create a table:")
df = pd.DataFrame({
'first column': [1, 2, 3, 4],
'second column': [10, 20, 30, 40]
})
st.write(df)
if st.checkbox('Show dataframe'):
chart_data = pd.DataFrame(
np.random.randn(20, 3),
columns=['a', 'b', 'c'])
chart_data
option = st.selectbox(
'Which number do you like best?',
df['first column'])
st.write('You selected: ', option)
text1 = st.text('This is some text.')
if st.button('Say hello'):
st.write('Why hello there')
else:
st.write('Goodbye')
agree = st.checkbox('I agree')
if agree:
st.write('Great!')
age = st.slider('How old are you?', 0, 130, 25)
st.write("I'm ", age, 'years old')
title = st.text_input('Movie title', 'Life of Brian')
st.write('The current movie title is', title)
number = st.number_input('Insert a number')
st.write('The current number is ', number)