spacr.row_exclusions¶
General row-exclusion rules shared by UMAP and its parameter search.
Functions¶
|
Drop rows matching any configured column/value rule. |
|
Return |
Module Contents¶
- spacr.row_exclusions.exclude_matching_rows(frame, rules: Any) tuple[Any, list[str]][source]¶
Drop rows matching any configured column/value rule.
- Parameters:
frame – table whose rows should be filtered.
rules – mapping or serialized row-exclusion rules.
Values are compared both in their native dtype and as stripped strings. This lets a value selected from SQLite text match the equivalent pandas numeric value without changing identifiers such as
"001".- Returns:
(filtered_frame, notes). Each note names the column, values, and number of rows removed.- Raises:
ValueError – for unknown columns or rules that remove every row.
- spacr.row_exclusions.normalize_row_exclusions(value: Any) dict[str, list[Any]][source]¶
Return
{column: [values...]}from settings or CSV text.- Parameters:
value – mapping or serialized mapping of columns to excluded values.
Noneand an empty value mean no exclusions. A scalar value is accepted as a one-item list so hand-written settings remain convenient.- Returns:
stripped column names mapped to ordered, deduplicated values.
- Raises:
ValueError – when a nonempty value cannot be parsed as a mapping.