{"record":{"id":"f74636f7e3f32f3d","repo":"pola-rs/polars","slug":"name-was-removed-in-version-version","errorCode":null,"errorMessage":"`{name}` was removed in version {version}","messagePattern":"`(.+?)` was removed in version (.+?)","errorType":"exception","errorClass":"AttributeRemovedError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/_utils/expired.py","lineNumber":62,"sourceCode":"    \"\"\"\n    Raise an `AttributeError` for a removed attribute.\n\n    Parameters\n    ----------\n    obj\n        The object from which the attribute was removed.\n    name\n        The name of the removed attribute.\n    attributes\n        A dictionary mapping removed attribute names to hints for replacement.\n    version\n        The version in which the attribute was removed.\n    \"\"\"\n    if name in attributes:\n        hint = attributes[name]\n        msg = f\"`{name}` was removed in version {version}\"\n        msg = f\"{msg}.\" if hint is None else f\"{msg}; {hint}\"\n        raise AttributeRemovedError(msg, name=name, obj=obj)\n\n\ndef getattr_fallback(\n    obj: object, superclass: object, name: str, *, meta: bool = False\n) -> Any:\n    \"\"\"\n    Raise an `AttributeError` for a non-existent attribute.\n\n    Parameters\n    ----------\n    obj\n        The object on which the attribute was accessed.\n    superclass\n        The superclass of the object used to attempt to access the attribute.\n    name\n        The name of the non-existent attribute.\n    meta\n        Whether the object is a metaclass (default: False).","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/pola-rs/polars/blob/5d8ebabf11caea54a5c29178a64a058762f49766/py-polars/src/polars/_utils/expired.py#L44-L80","documentation":"Raised by polars' expired-API machinery when code accesses an attribute (or dunder parameter) that was fully removed in a given polars version. The message includes the attribute name, removal version, and an optional migration hint. It exists to give a hard, informative failure instead of a bare AttributeError after the deprecation window closed.","triggerScenarios":"Calling raise_for_removed_attributes (usually wired via __getattr__ on classes like old DataFrame/Expr methods) after upgrading polars past the version listed in the message; e.g. df._rows, Expr.spearman_corr, or other attributes registered in the removal table.","commonSituations":"Upgrading py-polars across a major/minor release while user code or a third-party library still touches removed private/public attributes; stale notebooks or generated code referencing old APIs.","solutions":["Follow the hint in the error message (it names the replacement API)","Search the polars changelog / migration guide for the attribute name and version","Update the third-party library pinning the removed attribute","Pin polars to the older version only as a temporary stopgap while migrating"],"exampleFix":"# before\ndf._rows\n# after\ndf.rows()","handlingStrategy":"validation","validationCode":"removed = {'_rows': 'rows()', 'spearman_corr': 'corr'}\nif hasattr(obj, name := 'old_attr') and name in removed:\n    raise RuntimeError(f'use {removed[name]} instead')","typeGuard":"def uses_removed_attr(obj: object, name: str) -> bool:\n    try:\n        obj.__getattr__  # noqa\n        return name in getattr(type(obj), '_removed_attributes', {})\n    except AttributeError:\n        return False","tryCatchPattern":"try:\n    getattr(obj, name)\nexcept (AttributeError, Exception) as e:\n    if 'was removed in version' in str(e):\n        # parse hint and migrate\n        raise","preventionTips":["Run tests against new polars releases before upgrading","Search code for private underscore attributes","Follow the polars migration guide on each minor release"],"tags":["python","polars","removed-attribute","migration","version"],"backgroundTag":"removed-api-attribute","analyzedSha":"5d8ebabf11caea54a5c29178a64a058762f49766","analyzedAt":"2026-08-28T18:02:35.179Z","contentChangedAt":"2026-08-28T18:02:35.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}