Skip to content

Commit

Permalink
Prerelease 1.41.0 (#1195)
Browse files Browse the repository at this point in the history
* Dataframe index configuration example

* Column border example

* Metric border example

* Bump to nightly
  • Loading branch information
sfc-gh-dmatthews authored Dec 5, 2024
1 parent d1b7050 commit c34c2a7
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
18 changes: 18 additions & 0 deletions python/api-examples-source/data.dataframe_config_index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import streamlit as st
import pandas as pd
from datetime import date

df = pd.DataFrame(
{
"Date": [date(2024, 1, 1), date(2024, 2, 1), date(2024, 3, 1)],
"Total": [13429, 23564, 23452],
}
)
df.set_index("Date", inplace=True)

config = {
"_index": st.column_config.DateColumn("Month", format="MMM YYYY"),
"Total": st.column_config.NumberColumn("Total ($)"),
}

st.dataframe(df, column_config=config)
7 changes: 7 additions & 0 deletions python/api-examples-source/layout.columns_borders.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import streamlit as st

left, middle, right = st.columns(3, border=True)

left.markdown("Lorem ipsum " * 10)
middle.markdown("Lorem ipsum " * 5)
right.markdown("Lorem ipsum ")
10 changes: 10 additions & 0 deletions python/api-examples-source/metric.example4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import streamlit as st

a, b = st.columns(2)
c, d = st.columns(2)

a.metric("Temperature", "30°F", "-9°F", border=True)
b.metric("Wind", "4 mph", "2 mph", border=True)

c.metric("Humidity", "77%", "5%", border=True)
d.metric("Pressure", "30.34 inHg", "-2 inHg", border=True)
2 changes: 1 addition & 1 deletion python/api-examples-source/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ pydeck
Faker
openai
vega_datasets
streamlit>=1.40.0
streamlit-nightly

0 comments on commit c34c2a7

Please sign in to comment.