Skip to content

bug: ibis.pivot_wider fails when names_from is not string #11615

Open

Description

@vspinu

What happened?

Would it be possible either fail with clear error if names_from is not string, or cast to string internally? Thanks!

df = pl.DataFrame([{'series': 0,
  'day': 0,
  'pos': 7,
  'neg': 17},
 {'series': 0,
  'day': 3,
  'pos': 34,
  'neg': 17}])

tbl = ibis.memtable(df)
wtbl = tbl.pivot_wider(
    names_from="day",
    id_cols=["series", "pos", "neg"],
    values_from=["pos", "neg"],
    values_fill=0,
    names_sort=True,
    names_sep=":",
)

  File ibis/expr/types/relations.py:4461 in pivot_wider
    id_cols: s.Selector | None = None,

TypeError: sequence item 1: expected str instance, int found

What version of ibis are you using?

10.8

What backend(s) are you using, if any?

polars

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added
    bugIncorrect behavior inside of ibis
    on Sep 12, 2025
  2. bhargaviHQ commented on Oct 6, 2026

    @bhargaviHQ
    Contributor

    /take

  3. bhargaviHQ commented on Oct 6, 2026

    @bhargaviHQ
    Contributor

    I would like to work on this. It still happens on 12.0.0. If 0 or False is the only value, it silently produces a wrong column name, for example '' instead of 0.

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

Metadata

Metadata

Assignees

Labels

bugIncorrect behavior inside of ibis

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions