#29642·polars

`Expr.interpolate` panics or silently leaves nulls for non-numeric dtypes

Author: ajohnson5Created Sep 29, 2026Updated Sep 30, 2026
Labelsbugpythonneeds triageA-panic

Checks

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of Polars.

Reproducible example

Panic with expr.interpolate for bool dtype & linear method

python
lf = pl.LazyFrame({"a":[True, None, False]})
lf.with_columns(pl.col("a").interpolate()).collect(engine="streaming")
# thread '<unnamed>' (4427604) panicked at crates/polars-core/src/frame/mod.rs:708:42:
# should not fail: SchemaMismatch(ErrString("type Boolean is incompatible with expected type Float64"))

[!Note] This example must have a Null in. The example below does not panic (however note, the dtype of the output has been cast to pl.Float64. I believe this is the reason for the panic.

python
lf = pl.LazyFrame({"a":[True, False]})
lf.with_columns(pl.col("a").interpolate()).collect(engine="streaming")

Panic with expr.interpolate for bool dtype & nearest method

python
lf = pl.LazyFrame({"a":[True, None, False]})
lf.with_columns(pl.col("a").interpolate("nearest")).collect(engine="streaming")
# thread 'async-executor-5' (4427945) panicked at crates/polars-ops/src/series/ops/interpolation/interpolate.rs:124:23:
# not implemented for Boolean

Silently leaves nulls for bool type

python
df = pl.DataFrame({"a":[True, None, False]})
df.with_columns(pl.col("a").interpolate())

Log output

bash
thread '<unnamed>' (4427604) panicked at crates/polars-core/src/frame/mod.rs:708:42:
should not fail: SchemaMismatch(ErrString("type Boolean is incompatible with expected type Float64"))

Issue description

[!Note] Full disclosure I initially found the bug using AI where it found a panic expr.interpolate() in the streaming engine for boolean dtypes. I kept digging "manually", and found these other discrepancies that are detailed below.

expr.interpolate currently either panics or silently does nothing for non-numeric dtypes. This behaviour depends on, the method used, the dtype and the engine used. From what I can tell, there are three different cases outlined below, I have also included a table detailing the complete matrix of issues.

Cases

  1. Panic due to a schema mismatch (Boolean streaming)
  2. Panic with a "not implemented" error ("nearest" method)
  3. Silent incorrect behaviour
dtype interpolate() in-memory interpolate() streaming interpolate("nearest") in-memory interpolate("nearest") streaming
Int8–Int128, UInt8–UInt128 Correct Correct Correct Correct
Float16 / Float32 / Float64 Correct Correct Correct Correct
Decimal Correct Correct Correct Correct
Date / Datetime / Duration / Time Correct Correct Correct Correct
Boolean Incorrect (Unchanged) Panic (if the column contains nulls, otherwise cast to Float64) Panic Panic
String Incorrect (Unchanged) Incorrect (Unchanged) Panic Panic
Array Incorrect (Unchanged) Incorrect (Unchanged) Panic Panic
Object Incorrect (Unchanged) Incorrect (Unchanged) Panic Panic
Null Correct (nothing to fill) Correct (nothing to fill) Panic Correct (nothing to fill)
Binary / Categorical / Enum / List / Struct Incorrect (Unchanged) Incorrect (Unchanged) Incorrect (Unchanged) Incorrect (Unchanged)

Unchanged - Means nulls are incorrectly not filled.

For these non-numeric types, the sister expression, interpolate_by raises an InvalidOperationError. I have provided MREs for the boolean case, but happy to provide others for the other cases if needed.

Expected behavior

I would expect there to be no panics at least.

I think it would also make sense for the supported non-numerical dtypes of expr.interpolate to match the supported types of expr.interpolate_by. In which case, the panics and "unfilled" outputs would be replaced with a InvalidOperationError.

This would mean the following dtypes, String, Binary, Categorical, Enum, List, Array, Struct, Object, Boolean and Null would not be allowed for expr.interpolate(). Please let me know if you disagree or all/any of them.

Installed versions

Reproduces on 1.44.2 and main.

--------Version info---------
Polars:              1.44.2
Index type:          UInt32
Platform:            macOS-15.7.3-arm64-arm-64bit-Mach-O
Python:              3.13.5 (main, Jun 12 2025, 12:22:43) [Clang 20.1.4 ]
Runtime:             rt32

----Optional dependencies----
Azure CLI            <not installed>
adbc_driver_manager  <not installed>
altair               <not installed>
azure.identity       <not installed>
boto3                <not installed>
cloudpickle          <not installed>
connectorx           <not installed>
deltalake            <not installed>
fastexcel            <not installed>
fsspec               <not installed>
gevent               <not installed>
google.auth          <not installed>
great_tables         <not installed>
matplotlib           <not installed>
numpy                <not installed>
openpyxl             <not installed>
pandas               <not installed>
polars_cloud         <not installed>
pyarrow              <not installed>
pydantic             2.13.5
pyiceberg            <not installed>
sqlalchemy           <not installed>
torch                <not installed>
xlsx2csv             <not installed>
xlsxwriter           <not installed>