pola-rs/polars · error · AttributeRemovedError

` ` was deprecated in version 1.0.0. Define your own data…

Error message

`{name}` was deprecated in version 1.0.0. Define your own data type groups or use the `polars.selectors` module for selecting columns of a certain data type.

What it means

Accessing a legacy data type group (e.g. `polars.FLOATING`, `polars.INTEGER`) from the top-level `polars` module is blocked with `AttributeRemovedError`. Type-group constants were deprecated in 1.0.0 in favor of user-defined dtype collections or the `polars.selectors` module. The library removes them outright so old code fails loudly.

Solutions

  1. Use `polars.selectors` instead: `import polars.selectors as cs` then `df.select(cs.numeric())`, `cs.float()`, etc.
  2. Define your own group: `my_group = [pl.Float32, pl.Float64]` and use `df.select(pl.col(name).is_in(...))` or selectors with `cs.by_dtype(my_group)`.
  3. Grep the codebase for the removed names (`NUMERIC`, `FLOATING`, `INTEGER`, ...) and replace each occurrence.

Example fix

// before
df.select(polars.FLOATING)

// after
import polars.selectors as cs
df.select(cs.float())
Defensive patterns

Strategy: validation

Validate before calling

import polars.datatypes.group as dtgroup
assert not hasattr(dtgroup, 'FLOATING') or True  # legacy check

Try / catch

try:
    group = polars.FLOATING
except Exception:
    import polars.selectors as cs
    group = cs.float()

Prevention

When it happens

Trigger: Any `polars.<TypeNameGroup>` attribute access where the name is in `polars.datatypes.group` (e.g. `polars.NUMERIC`, `polars.FLOATING`) on polars >= 1.0.0.

Common situations: Migrated code selecting columns by dtype group; old predicates like `df.select(polars.NUMERIC)`; snippets from pre-1.0 documentation or blog posts.

Understand the failure class

Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.

Related errors


AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18). Data as JSON: /api/errors/d94f882ea0585dd0. Report an issue: GitHub.

Appendix: source

Thrown at py-polars/src/polars/__init__.py:543

        # Deprecate re-export of exceptions at top-level
        if name in dir(exceptions):
            msg = (
                f"accessing `{name}` from the top-level `polars` module was deprecated "
                "in version 1.0.0. Import it directly from the `polars.exceptions` module "
                f"instead, e.g.: `from polars.exceptions import {name}`"
            )
            raise exceptions.AttributeRemovedError(msg)

        # Deprecate data type groups at top-level
        import polars.datatypes.group as dtgroup

        if name in dir(dtgroup):
            msg = (
                f"`{name}` was deprecated in version 1.0.0. Define your own data type groups or "
                "use the `polars.selectors` module for selecting columns of a certain data type."
            )
            raise exceptions.AttributeRemovedError(msg)

        # Functions removed in 2.0
        removed = {
            "arctan2d": "use `arctan2` followed by `.degrees()` instead.",
            "groups": "use `df.with_row_index().group_by(...).agg(pl.col('index'))` instead.",
            "read_csv_batched": "use `scan_csv` instead, in conjunction with `LazyFrame.collect(engine='streaming')`.",
            "threadpool_size": "it was renamed; use `thread_pool_size` instead.",
        }
        if name in removed:
            msg = f"`{name}` was removed in version 2.0; {removed[name]}"
            raise exceptions.AttributeRemovedError(msg)

        msg = f"module {__name__!r} has no attribute {name!r}"
        raise AttributeError(msg)

View on GitHub (pinned to fe841f959e)