File size: 1,521 Bytes
7298faa |
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 53 |
import streamlit as st
import pandas as pd
# Set Streamlit theme
st.set_page_config(page_title="Power BI-like Dashboard", page_icon=":chart_with_upwards_trend:")
# Upload CSV file
uploaded_file = st.file_uploader("Choose a CSV file", type="csv")
# Custom CSS styles
custom_styles = """
body {
background-color: #f4f4f4;
}
.css-1k6zjxx {
max-width: none;
}
"""
# Apply custom CSS
st.markdown(f'<style>{custom_styles}</style>', unsafe_allow_html=True)
if uploaded_file is not None:
# Read data from CSV
df = pd.read_csv(uploaded_file)
# Display raw data in compact layout
st.subheader("Raw Data")
st.dataframe(df, height=400)
# Basic statistics in compact layout
st.subheader("Basic Statistics")
st.dataframe(df.describe(), height=200)
# Select columns for analysis
selected_columns = st.multiselect("Select columns for analysis", df.columns)
if selected_columns:
# Line chart in compact layout
st.subheader("Line Chart")
st.line_chart(df[selected_columns], use_container_width=True)
# Bar chart in compact layout
st.subheader("Bar Chart")
st.bar_chart(df[selected_columns], use_container_width=True)
# Area chart in compact layout
st.subheader("Area Chart")
st.area_chart(df[selected_columns], use_container_width=True)
# Interactive table in compact layout
st.subheader("Interactive Table")
st.dataframe(df[selected_columns], height=400) |