pola-rs/polars · error
column must be a Series or Expr, got {column!r} (type={quali
Error message
column must be a Series or Expr, got {column!r} (type={qualified_type_name(column)}) What it means
Error "column must be a Series or Expr, got {column!r} (type={qualified_type_name(column)})" thrown in pola-rs/polars.
Source
Thrown at py-polars/src/polars/dataframe/frame.py:5388
if index < 0:
msg = f"column index {original_index} is out of range (frame has {self.width} columns)"
raise IndexError(msg)
elif index > self.width:
msg = f"column index {original_index} is out of range (frame has {self.width} columns)"
raise IndexError(msg)
if isinstance(column, pl.Series):
self._df.insert_column(index, column._s)
else:
if isinstance(column, str):
column = F.col(column)
if isinstance(column, pl.Expr):
cols = self.columns
cols.insert(index, column) # type: ignore[arg-type]
self._df = self.select(cols)._df
else:
msg = f"column must be a Series or Expr, got {column!r} (type={qualified_type_name(column)})"
raise TypeError(msg)
return self
def filter(
self,
*predicates: (
IntoExprColumn
| Iterable[IntoExprColumn]
| bool
| list[bool]
| np.ndarray[Any, Any]
),
**constraints: Any,
) -> DataFrame:
"""
Filter rows, retaining those that match the given predicate expression(s).
The original order of the remaining rows is preserved.
View on GitHub (pinned to df599052da)
When it happens
Trigger: Thrown at py-polars/src/polars/dataframe/frame.py:5388 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of pola-rs/polars@df599052da (2026-08-16).
Data as JSON: /api/errors/d89247c022ad2653.
Report an issue: GitHub.