import streamlit as st import pandas as pd from ydata_profiling import ProfileReport # Set page config (must be the first Streamlit command) st.set_page_config(page_title="Dynamic Data Profiling", layout="wide", page_icon="📊") # App title st.title("Dynamic Data Profiling with ydata-profiling") st.write("Upload your CSV file and get a complete interactive profiling report!") # File uploader widget uploaded_file = st.file_uploader("Upload a CSV file", type="csv") if uploaded_file is not None: try: # Read CSV into DataFrame df = pd.read_csv(uploaded_file) st.success("File uploaded successfully!") # Generate the profile report with st.spinner("Generating profile report..."): profile = ProfileReport(df, title="Profiling Report", explorative=True) # Get HTML representation of the report report_html = profile.to_html() # Display the report in an iframe st.components.v1.html(report_html, height=1200, scrolling=True) except Exception as e: st.error(f"An error occurred: {e}") else: st.info("Awaiting CSV file upload.")