Issue using st.dataframe with df.styles.format to format floats with 2 decimal places. See gist containing minimal case with 2 files at:
issue-fail.py
import streamlit as st
import pandas as pd
df = pd.read_csv("https://leg-2-lou-docs-pics.s3.us-west-2.amazonaws.com/reports/invoices_fail_8193_rows.csv", dtype=str, parse_dates=[8,9])
col1, col2 = st.columns(2)
with col1:
st.markdown("# Invoices ")
This file has been truncated. show original
issue.py
import streamlit as st
import pandas as pd
df = pd.read_csv("https://leg-2-lou-docs-pics.s3.us-west-2.amazonaws.com/reports/invoices_success_8192_rows.csv", dtype=str, parse_dates=[8,9])
col1, col2 = st.columns(2)
with col1:
st.markdown("# Invoices ")
This file has been truncated. show original
ERROR occurs at line containing this statement:
st.dataframe(df.style.format({‘ItemSubTotalAmount’: ‘{:.2f}’, ‘TaxAmount’: ‘{:.2f}’, ‘TotalAmount’: ‘{:.2f}’}))
REPRODUCTION STEPS:
SUCCESS CASE:
streamlit run https://gist.github.com/evoshawkins/1432dc9dd3c6a4358c8eb28688519734/raw/5bc7998d663779150389973313c4a1396348ded2/issue.py
FAIL CASE:
streamlit run https://gist.github.com/evoshawkins/1432dc9dd3c6a4358c8eb28688519734/raw/5bc7998d663779150389973313c4a1396348ded2/issue-fail.py
The 1st example reads the CSV file from:
“https://leg-2-lou-docs-pics.s3.us-west-2.amazonaws.com/reports/invoices_success_8456_rows.csv ”
The 2nd example points read the CSV file from: (it has one more row):
“https://leg-2-lou-docs-pics.s3.us-west-2.amazonaws.com/reports/invoices_fail_8457_rows.csv ”
1 Like
jrichey
September 28, 2022, 11:45pm
2
+1
I also encounter this error attempting to display a large pandas styled dataframe.
With 58 columns (28 styled):
no error displaying 4519 rows or less
error displaying 4520 rows or more
system
Closed
January 13, 2024, 9:01am
4
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.