Hello,
I am using Streamlit to visualize my ydata_profiling
report.
However when I am selecting a work_order to generate a profile report it keeps on crashing without any error message.
Attached screenshot:
I have used the same code in jupyter notebook and it is working fine. Please see reference:
The code is as follows:
# Analytics Section
if choice == 'π Analytics':
st.subheader('Analytics')
# Fetch all unique work orders from MongoDB
work_orders = collection.distinct('Work_Order')
if work_orders:
# Create a multi-select dropdown for work orders
selected_work_orders = st.multiselect('Select Work Orders:', work_orders)
if selected_work_orders:
# Fetch data for the selected work orders
records = list(collection.find({"Work_Order": {"$in": selected_work_orders}}))
if records:
# Convert the list of MongoDB records to a DataFrame
df = pd.DataFrame(records)
# Drop the MongoDB internal fields if it's not needed
if '_id' in df.columns:
df = df.drop(columns=['_id'])
df = df.drop(columns=['Object_Detection_Visual'])
# Generate a profiling report using ydata-profiling
profile = ProfileReport(df, title="Work Orders Data Profile", minimal=True)
# Display the profiling report in Streamlit
st_profile_report(profile)
else:
st.write("No data found for the selected work orders.")
else:
st.write("Please select one or more work orders to analyze.")
else:
st.write("No work orders available.")
Also I am fetching the data from MongoDB and I have checked mongodb is connected.
The dataframe is as follows:
Work_Order | Order_Number | Category | Subcategory | Prefix | Description | Object_Detection |
---|---|---|---|---|---|---|
AUDPP_20240818_232438 | 11-02-22-after (29).jpg | Yard Maintenance | Initial Grass Cut | After | Rear Lawn | |
AUDPP_20240818_232438 | 11-02-22-after (30).jpg | Boarding and Reglazing | Initial Grass Cut | After | Rear Lawn | |
AUDPP_20240818_232438 | 11-02-22-before (36).jpg | Yard Maintenance | Initial Grass Cut | Before | Rear Lawn | |
AUDPP_20240818_232438 | 11-02-22-before (41).jpg | Yard Maintenance | Initial Grass Cut | Before | Rear Lawn | |
AUDPP_20240818_232438 | 11-02-22-during (35)e.jpg | Yard Maintenance | Initial Grass Cut | During | Rear Lawn | lawnmower |
AUDPP_20240818_232438 | 11-02-22-during (44)e.jpg | Yard Maintenance | Initial Grass Cut | During | Weed Whacking | weedwhacker |
Versions:
os: Windows
python: 3.11
streamlit: 1.35.0
streamlit-pandas-profiling: 0.1.3
ydata-profiling: 4.9.0