Spaces:
Sleeping
Sleeping
File size: 1,306 Bytes
aa5cda2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
"""Data display utilities"""
import streamlit as st
import pandas as pd
def display_data_preview(data: list, columns: list):
"""Display data preview"""
if not data:
st.warning("No data to display")
return
st.subheader("π Data Preview")
# Convert to DataFrame for better display
df = pd.DataFrame(data)
# Display summary
col1, col2, col3 = st.columns(3)
with col1:
st.metric("Total Rows", len(df))
with col2:
st.metric("Total Columns", len(df.columns))
with col3:
st.metric("Memory Usage", f"{df.memory_usage().sum() / 1024:.2f} KB")
st.divider()
# Display data table
st.dataframe(df, use_container_width=True)
st.divider()
# Display statistics
st.subheader("π Data Statistics")
st.dataframe(df.describe(), use_container_width=True)
def display_analysis_results(results: dict):
"""Display analysis results"""
st.subheader("π Analysis Results")
if "error" in results:
st.error(f"Analysis failed: {results['error']}")
return
# Display results based on type
if "results" in results:
st.write(results["results"])
if "summary" in results:
st.info(f"**Summary:** {results['summary']}")
|