CCockrum commited on
Commit
e1cc37a
·
verified ·
1 Parent(s): 21b2b3f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -266,15 +266,19 @@ if fetch_data:
266
  <h4 style='margin-bottom: 1rem; color: lightgray;'>Field Completeness Breakdown</h4>
267
  """, unsafe_allow_html=True)
268
 
269
- # Create a styled dataframe showing completeness percentages
270
  completeness_df = pd.DataFrame({
271
  "Field": completeness.index,
272
  "Completeness (%)": completeness.values
273
  })
274
 
 
 
 
 
275
  # Display the dataframe directly in the sidebar
276
  st.dataframe(
277
- completeness_df.style.background_gradient(cmap="Greens").format("{:.1f}%"),
278
  use_container_width=True,
279
  height=240
280
  )
@@ -288,6 +292,9 @@ if fetch_data:
288
  # Metadata completeness analysis (bar chart)
289
  st.subheader("Metadata Completeness Analysis")
290
 
 
 
 
291
  # Create a bar chart with a dark theme to match the screenshot
292
  fig = px.bar(
293
  completeness_df,
 
266
  <h4 style='margin-bottom: 1rem; color: lightgray;'>Field Completeness Breakdown</h4>
267
  """, unsafe_allow_html=True)
268
 
269
+ # Create a dataframe showing completeness percentages
270
  completeness_df = pd.DataFrame({
271
  "Field": completeness.index,
272
  "Completeness (%)": completeness.values
273
  })
274
 
275
+ # FIX: Format the values before styling to avoid the ValueError
276
+ # Convert percentages to strings with format applied
277
+ completeness_df["Completeness (%)"] = completeness_df["Completeness (%)"].apply(lambda x: f"{x:.1f}")
278
+
279
  # Display the dataframe directly in the sidebar
280
  st.dataframe(
281
+ completeness_df, # No styling applied here to avoid format errors
282
  use_container_width=True,
283
  height=240
284
  )
 
292
  # Metadata completeness analysis (bar chart)
293
  st.subheader("Metadata Completeness Analysis")
294
 
295
+ # FIX: Convert percentages to numeric for plotting
296
+ completeness_df["Completeness (%)"] = pd.to_numeric(completeness_df["Completeness (%)"])
297
+
298
  # Create a bar chart with a dark theme to match the screenshot
299
  fig = px.bar(
300
  completeness_df,