pola-rs/polars · error
cannot coerce datatypes
Error message
cannot coerce datatypes
What it means
Error "cannot coerce datatypes" thrown in pola-rs/polars.
Source
Thrown at crates/polars-core/src/series/arithmetic/borrowed.rs:272
let ca: Float64Chunked =
arity::binary_elementwise(lhs, rhs, |opt_l, opt_r| match (opt_l, opt_r) {
(Some(l), Some(r)) => {
if r.is_zero() {
None
} else {
Some(l / r)
}
},
_ => None,
});
Ok(ca.into_series())
}
}
impl NumOpsDispatchChecked for Series {
fn checked_div(&self, rhs: &Series) -> PolarsResult<Series> {
let (lhs, rhs) = coerce_lhs_rhs(self, rhs).expect("cannot coerce datatypes");
lhs.as_ref().as_ref().checked_div(rhs.as_ref())
}
fn checked_div_num<T: ToPrimitive>(&self, rhs: T) -> PolarsResult<Series> {
use DataType::*;
let s = self.to_physical_repr();
let out = match s.dtype() {
#[cfg(feature = "dtype-u8")]
UInt8 => s
.u8()
.unwrap()
.apply(|opt_v| opt_v.and_then(|v| v.checked_div(rhs.to_u8().unwrap())))
.into_series(),
#[cfg(feature = "dtype-i8")]
Int8 => s
.i8()
.unwrap()View on GitHub (pinned to df599052da)
When it happens
Trigger: Thrown at crates/polars-core/src/series/arithmetic/borrowed.rs:272 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/61b16b8b55e344c9.
Report an issue: GitHub.