Create App.py
Browse files
App.py
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
|
4 |
+
# Set Streamlit theme
|
5 |
+
st.set_page_config(page_title="Power BI-like Dashboard", page_icon=":chart_with_upwards_trend:")
|
6 |
+
|
7 |
+
# Upload CSV file
|
8 |
+
uploaded_file = st.file_uploader("Choose a CSV file", type="csv")
|
9 |
+
|
10 |
+
# Custom CSS styles
|
11 |
+
custom_styles = """
|
12 |
+
body {
|
13 |
+
background-color: #f4f4f4;
|
14 |
+
}
|
15 |
+
.css-1k6zjxx {
|
16 |
+
max-width: none;
|
17 |
+
}
|
18 |
+
"""
|
19 |
+
|
20 |
+
# Apply custom CSS
|
21 |
+
st.markdown(f'<style>{custom_styles}</style>', unsafe_allow_html=True)
|
22 |
+
|
23 |
+
if uploaded_file is not None:
|
24 |
+
# Read data from CSV
|
25 |
+
df = pd.read_csv(uploaded_file)
|
26 |
+
|
27 |
+
# Display raw data in compact layout
|
28 |
+
st.subheader("Raw Data")
|
29 |
+
st.dataframe(df, height=400)
|
30 |
+
|
31 |
+
# Basic statistics in compact layout
|
32 |
+
st.subheader("Basic Statistics")
|
33 |
+
st.dataframe(df.describe(), height=200)
|
34 |
+
|
35 |
+
# Select columns for analysis
|
36 |
+
selected_columns = st.multiselect("Select columns for analysis", df.columns)
|
37 |
+
|
38 |
+
if selected_columns:
|
39 |
+
# Line chart in compact layout
|
40 |
+
st.subheader("Line Chart")
|
41 |
+
st.line_chart(df[selected_columns], use_container_width=True)
|
42 |
+
|
43 |
+
# Bar chart in compact layout
|
44 |
+
st.subheader("Bar Chart")
|
45 |
+
st.bar_chart(df[selected_columns], use_container_width=True)
|
46 |
+
|
47 |
+
# Area chart in compact layout
|
48 |
+
st.subheader("Area Chart")
|
49 |
+
st.area_chart(df[selected_columns], use_container_width=True)
|
50 |
+
|
51 |
+
# Interactive table in compact layout
|
52 |
+
st.subheader("Interactive Table")
|
53 |
+
st.dataframe(df[selected_columns], height=400)
|