feat: add live surviving rows preview in match group editor
Shows a read-only preview of the output rows below the editor, updating as checkboxes and column dropdowns are changed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -422,10 +422,11 @@ def match_group_card(
|
|||||||
f"{', '.join(differing_cols)}"
|
f"{', '.join(differing_cols)}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Status
|
# Status + surviving rows preview
|
||||||
if len(checked) == 0:
|
if len(checked) == 0:
|
||||||
st.warning("Select at least one row to keep.")
|
st.warning("Select at least one row to keep.")
|
||||||
elif len(checked) == n_rows:
|
else:
|
||||||
|
if len(checked) == n_rows:
|
||||||
st.caption("Keeping all rows (no duplicates removed)")
|
st.caption("Keeping all rows (no duplicates removed)")
|
||||||
elif len(checked) == 1:
|
elif len(checked) == 1:
|
||||||
st.caption(
|
st.caption(
|
||||||
@@ -438,6 +439,17 @@ def match_group_card(
|
|||||||
f"removing {n_rows - len(checked)}"
|
f"removing {n_rows - len(checked)}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Build preview of surviving rows with edits applied
|
||||||
|
checked_positions = [
|
||||||
|
i for i, idx in enumerate(group.row_indices)
|
||||||
|
if idx in checked
|
||||||
|
]
|
||||||
|
preview = edited.iloc[checked_positions].drop(
|
||||||
|
columns=["Keep"],
|
||||||
|
).reset_index(drop=True)
|
||||||
|
st.markdown("**Surviving rows preview:**")
|
||||||
|
st.dataframe(preview, use_container_width=True, hide_index=True)
|
||||||
|
|
||||||
# Confirm
|
# Confirm
|
||||||
def _on_confirm(
|
def _on_confirm(
|
||||||
g=gid, indices=list(group.row_indices),
|
g=gid, indices=list(group.row_indices),
|
||||||
|
|||||||
Reference in New Issue
Block a user