Skip to content

Commit

Permalink
Use df.height to get the number of rows in a DataFrame
Browse files Browse the repository at this point in the history
  • Loading branch information
jrycw committed Dec 18, 2024
1 parent 993baff commit 34d7452
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions great_tables/_locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,8 +839,6 @@ def resolve_mask_i(
excl_group: bool = True,
) -> list[tuple[int, int, str]]:
"""Return data for creating `CellPos`, based on expr"""
import polars as pl

if not isinstance(expr, PlExpr):
raise ValueError("Only Polars expressions can be passed to the `mask` argument.")

Expand All @@ -861,7 +859,7 @@ def resolve_mask_i(
raise ValueError("The `mask` may reference columns not in the original DataFrame.")

# Validate that row lengths are equal
if not (masked.select(pl.len()).item(0, "len") == frame.select(pl.len()).item(0, "len")):
if masked.height != frame.height:
raise ValueError("The DataFrame length after applying `mask` differs from the original.")

cellpos_data: list[tuple[int, int, str]] = [] # column, row, colname for `CellPos`
Expand Down

0 comments on commit 34d7452

Please sign in to comment.