Skip to content

col_summary_tbl() fails with a ShapeError when a boolean column has no False values #465

Closed

Description

@DG47

Description

col_summary_tbl() raises an error whenever a boolean column contains no False values: a column that is all True, True plus missing values, or any boolean column in a one-row table. This happens on Polars, Pandas and DuckDB (Ibis) tables.

Minimal reproducible example

import polars as pl
import pointblank as pb

pb.col_summary_tbl(pl.DataFrame({"is_active": [True, True, True]}))
narwhals.exceptions.ShapeError: can't broadcast Series '__freq_true' of length 2 to length 1

The same happens with:

import ibis
import pandas as pd

pb.col_summary_tbl(pl.DataFrame({"flag": [True]}))                    # one-row table
pb.col_summary_tbl(pl.DataFrame({"flag": [True, None, True]}))        # True plus missing values
pb.col_summary_tbl(pd.DataFrame({"flag": [True, True]}))              # ShapeError: Expected object of length 1, got: 2.
pb.col_summary_tbl(ibis.memtable({"flag": [True, True], "x": [1, 2]}))  # ShapeError: Expected object of length 2, got: 3.

A related case gives wrong output with no error. When the first boolean column has values that the next one lacks, the next column loses its T/F summary or shows the wrong False share:

pb.col_summary_tbl(pl.DataFrame({"a": [True, True, False], "b": [True, True, True]}))
# `b` shows a plain unique count instead of "T 1 / F 0"

pb.col_summary_tbl(pl.DataFrame({"a": [True, True, True], "b": [True, False, None]}))
# `b` shows "F 0" even though one third of its values are False

Expected

Every boolean column is summarized as the share of True and False values, e.g. "T 1 / F 0" for an all-True column.

Actual

Either a ShapeError is raised, or the summary for the later boolean column is missing or wrong.

The frequencies stored for a boolean column (freqs) only have keys for the values that are present, e.g. {"True": 3} for an all-True column. In the report, the T/F extraction then either reads a key that doesn't exist or builds one struct column for all boolean columns using only the first column's keys.

Environment

  • pointblank main (6ba7841)
  • Python 3.12.13, polars 2.0.0, pandas 2.3.3, narwhals 2.27.1, ibis-framework 12.0.0, duckdb 1.3.2, great_tables 1.0.0
  • macOS (arm64)

Activity

  1. rich-iannone commented on Oct 15, 2026

    @rich-iannone
    Member

    Thanks for reporting this! Just opened #466 to address the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions