chore: migrate use_container_width → width (Streamlit deprecation)
``use_container_width`` is being removed after 2025-12-31. Streamlit log was flooding the terminal with the deprecation notice on every rerun. Mechanical sweep: use_container_width=True → width="stretch" use_container_width=False → width="content" 51 call sites across 11 page files + ``app_demo.py``. Also renamed the ``local_download_button`` helper's ``use_container_width`` kwarg to ``width`` (default ``"stretch"``); it has no external callers passing the old name, so this is a safe rename. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -106,7 +106,7 @@ _has_result = st.session_state.get("missing_result") is not None
|
||||
|
||||
with st.expander(f"Preview: {uploaded.name}", expanded=not _has_result):
|
||||
st.caption(f"{len(df)} rows, {len(df.columns)} columns")
|
||||
st.dataframe(df.head(10), use_container_width=True)
|
||||
st.dataframe(df.head(10), width="stretch")
|
||||
|
||||
st.divider()
|
||||
|
||||
@@ -134,7 +134,7 @@ with st.expander("Options", expanded=not _has_result):
|
||||
m3.metric("% cells missing", f"{initial_profile.cells_missing_pct:.1f}%")
|
||||
m4.metric("Complete rows", initial_profile.rows_complete)
|
||||
|
||||
st.dataframe(prof_df, use_container_width=True, hide_index=True)
|
||||
st.dataframe(prof_df, width="stretch", hide_index=True)
|
||||
|
||||
if initial_profile.cells_missing == 0:
|
||||
st.success("No missing values or disguised nulls detected. Nothing to handle.")
|
||||
@@ -259,7 +259,7 @@ with st.expander("Options", expanded=not _has_result):
|
||||
})
|
||||
edited = st.data_editor(
|
||||
edit_df,
|
||||
use_container_width=True,
|
||||
width="stretch",
|
||||
hide_index=True,
|
||||
column_config={
|
||||
"column": st.column_config.TextColumn("Column", disabled=True),
|
||||
@@ -285,7 +285,7 @@ with st.expander("Options", expanded=not _has_result):
|
||||
|
||||
st.divider()
|
||||
|
||||
if st.button("Handle Missing Values", type="primary", use_container_width=True):
|
||||
if st.button("Handle Missing Values", type="primary", width="stretch"):
|
||||
with st.spinner("Handling..."):
|
||||
try:
|
||||
result = handle_missing(df, options)
|
||||
@@ -345,25 +345,25 @@ after = result.profile_after.to_dataframe().set_index("column")[
|
||||
["missing", "missing_pct"]
|
||||
].rename(columns={"missing": "after_missing", "missing_pct": "after_pct"})
|
||||
combined = before.join(after, how="outer").fillna(0)
|
||||
st.dataframe(combined, use_container_width=True)
|
||||
st.dataframe(combined, width="stretch")
|
||||
|
||||
if result.strategy_per_column:
|
||||
st.markdown("**Strategy applied per column**")
|
||||
strat_df = pd.DataFrame(
|
||||
[{"column": c, "strategy": s} for c, s in result.strategy_per_column.items()]
|
||||
)
|
||||
st.dataframe(strat_df, use_container_width=True, hide_index=True)
|
||||
st.dataframe(strat_df, width="stretch", hide_index=True)
|
||||
|
||||
if not result.changes.empty:
|
||||
st.markdown("**Audit (first 50 changes)**")
|
||||
audit_view = result.changes.head(50).copy()
|
||||
audit_view["row"] = audit_view["row"].apply(lambda x: "—" if x == -1 else x + 1)
|
||||
st.dataframe(audit_view, use_container_width=True, hide_index=True)
|
||||
st.dataframe(audit_view, width="stretch", hide_index=True)
|
||||
if len(result.changes) > 50:
|
||||
st.caption(f"… and {len(result.changes) - 50} more (download the full audit below).")
|
||||
|
||||
st.markdown("**Handled preview (first 10 rows)**")
|
||||
st.dataframe(result.handled_df.head(10), use_container_width=True)
|
||||
st.dataframe(result.handled_df.head(10), width="stretch")
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Downloads
|
||||
|
||||
Reference in New Issue
Block a user