DataViz Pro: Interactive Data Analysis Hub
DataViz Pro: Interactive Data Analysis Hub
Explore, Visualize, and Collaborate on Data
Streamlit App Code:
#!/usr/bin/env python3
import streamlit as st
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import time
Title and header for the app
st.title("DataViz Pro: Interactive Data Analysis Hub")
st.header("Explore, Visualize, and Collaborate on Data")
Sidebar for file upload and configuration
st.sidebar.header("Upload Your Dataset")
uploaded_file = st.sidebar.file_uploader("Upload CSV", type=["csv"])
Sidebar for chart type and settings
st.sidebar.subheader("Visualization Settings")
chart_type = st.sidebar.radio("Select Chart Type", ["Line Chart", "Bar Chart", "Scatter Plot", "Area Chart", "Pie Chart"])
color_picker = st.sidebar.color_picker("Pick a chart color", "#00f900")
filter_value = st.sidebar.slider("Minimum Value Filter", 0, 100, 50)
Sidebar checkbox to show/hide chat section
collaboration_mode = st.sidebar.checkbox("Enable Collaboration Mode")
Sidebar feedback section
with st.sidebar.expander("Submit Your Feedback"):
feedback = st.text_area("Write your feedback here")
if st.button("Submit Feedback"):
st.sidebar.success("Thank you for your feedback!")
Load data if file is uploaded
if uploaded_file:
data = pd.read_csv(uploaded_file)
st.write("### Raw Data Preview")
st.dataframe(data.head(10))
# Filter data based on user input
filter_column = st.selectbox("Select Column to Filter", data.columns)
filtered_data = data[data[filter_column] > filter_value]
st.write(f"Filtered Data (where {filter_column} > {filter_value})")
st.dataframe(filtered_data)
# Visualization of filtered data
st.subheader(f"{chart_type} for {filter_column}")
if chart_type == "Line Chart":
st.line_chart(filtered_data[filter_column], height=400, use_container_width=True)
elif chart_type == "Bar Chart":
st.bar_chart(filtered_data[filter_column], height=400, use_container_width=True)
elif chart_type == "Scatter Plot":
fig, ax = plt.subplots()
ax.scatter(filtered_data.index, filtered_data[filter_column], color=color_picker)
st.pyplot(fig)
elif chart_type == "Area Chart":
st.area_chart(filtered_data[filter_column], height=400, use_container_width=True)
elif chart_type == "Pie Chart":
pie_data = filtered_data[filter_column].value_counts()
fig, ax = plt.subplots()
ax.pie(pie_data, labels=pie_data.index, autopct='%1.1f%%', colors=[color_picker])
st.pyplot(fig)
# Expander for data summary statistics
with st.expander("Summary Statistics"):
st.write(filtered_data.describe())
# Option to download filtered data
st.subheader("Download Filtered Data")
csv = filtered_data.to_csv(index=False)
st.download_button("Download CSV", data=csv, file_name="filtered_data.csv", mime="text/csv")
Simulating data processing with progress bar
st.header("Data Processing Progress")
with st.spinner("Processing your data..."):
progress_bar = st.progress(0)
for i in range(100):
time.sleep(0.05)
progress_bar.progress(i + 1)
st.success("Data processing completed!")
Metrics visualization
st.header("Key Metrics")
if uploaded_file:
st.metric("Maximum Value", filtered_data[filter_column].max())
st.metric("Minimum Value", filtered_data[filter_column].min())
st.metric("Mean Value", round(filtered_data[filter_column].mean(), 2))
Collaboration Mode Section
if collaboration_mode:
st.header("Collaborative Analysis and Feedback")
chat_message = st.chat_input("Send a message to the team")
if chat_message:
st.write(f"You: {chat_message}")
with st.expander("Chat History"):
st.chat_message("Analyst1").write("Analyst1: Let's review the outliers.")
st.chat_message("Analyst2").write("Analyst2: I agree! The patterns are interesting.")
Latex Formula Display Example
st.latex(r"\int_a^b f(x)dx = F(b) - F(a)")
Long-running task simulation with spinner
st.header("Running Advanced Analysis")
with st.spinner("Performing complex computations..."):
time.sleep(3)
st.success("Advanced analysis completed!")
Footer Section
st.markdown("---")
st.text("DataViz Pro © 2024 | Empowering Data-Driven Decisions")
Features of DataViz Pro (200 lines):
Interactive Data Filtering and Visualizations: Users can upload CSV files, filter data based on a selected column, and visualize it using multiple chart types, including line, bar, scatter, area, and pie charts.
Collaborative Feedback and Chat: Collaboration mode allows users to leave feedback, interact through a live chat system, and analyze the data collaboratively with team members.
Progress Bars, Metrics, and Downloadable Data: The app includes real-time progress bars, dynamic metric displays (max, min, mean values), and allows users to download filtered datasets in CSV format.
Detailed Breakdown:
File Upload & Data Processing: The app accepts CSV uploads, displays a preview, allows column-based filtering, and visualizes the filtered data in various chart formats.
Collaboration Tools: Live chat and feedback forms enable collaborative discussion and real-time feedback from team members.
Visualization Options: A variety of chart options (line, bar, scatter, pie) combined with customizable chart colors enhance the data visualization experience for users.
This streamlit app delivers an advanced interactive platform for data exploration, visualization, collaboration, and feedback. It’s ideal for teams or individuals who need deep insights and flexible analytics from their data.
DataViz Pro © 2024 | Empowering Data-Driven Decisions