forked from streamlit/streamlit-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
76 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,77 @@ | ||
import streamlit as st | ||
import plotly.express as px | ||
df = px.data.tips() | ||
fig = px.histogram(df, x="total_bill") | ||
fig.show() | ||
# 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:") | ||
st.write(pd.DataFrame({ | ||
'first column': [1, 2, 3, 4], | ||
'second column': [10, 20, 30, 40] | ||
})) | ||
|
||
|
||
""" | ||
# My first app | ||
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] | ||
}) | ||
|
||
df | ||
|
||
chart_data = pd.DataFrame( | ||
np.random.randn(20, 3), | ||
columns=['a', 'b', 'c']) | ||
|
||
st.line_chart(chart_data) | ||
|
||
map_data = pd.DataFrame( | ||
np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4], | ||
columns=['lat', 'lon']) | ||
|
||
st.map(map_data) | ||
|
||
if st.checkbox('Show dataframe'): | ||
chart_data = pd.DataFrame( | ||
np.random.randn(20, 3), | ||
columns=['a', 'b', 'c']) | ||
|
||
chart_data | ||
|
||
|
||
option = st.sidebar.selectbox( | ||
'Which number do you like best?', | ||
df['first column']) | ||
|
||
'You selected:', option | ||
|
||
left_column, right_column = st.beta_columns(2) | ||
pressed = left_column.button('Press me?') | ||
if pressed: | ||
right_column.write("Woohoo!") | ||
|
||
expander = st.beta_expander("FAQ") | ||
expander.write("Here you could put in some really, really long explanations...") | ||
|
||
|
||
import time | ||
|
||
'Starting a long computation...' | ||
|
||
# Add a placeholder | ||
latest_iteration = st.empty() | ||
bar = st.progress(0) | ||
|
||
for i in range(100): | ||
# Update the progress bar with each iteration. | ||
latest_iteration.text(f'Iteration {i+1}') | ||
bar.progress(i + 1) | ||
time.sleep(0.1) | ||
|
||
'...and now we\'re done!' |