pola-rs/polars · error
could not cast
Error message
could not cast
What it means
Error "could not cast" thrown in pola-rs/polars.
Source
Thrown at crates/polars-core/src/series/arithmetic/borrowed.rs:835
impl<T> Rem<T> for Series
where
T: Num + NumCast,
{
type Output = Self;
fn rem(self, rhs: T) -> Self::Output {
(&self).rem(rhs)
}
}
/// We cannot override the left hand side behaviour. So we create a trait LhsNumOps.
/// This allows for 1.add(&Series)
///
impl<T: PolarsNumericType> ChunkedArray<T> {
/// Apply lhs - self
#[must_use]
pub fn lhs_sub<N: Num + NumCast>(&self, lhs: N) -> Self {
let lhs: T::Native = NumCast::from(lhs).expect("could not cast");
ArithmeticChunked::wrapping_sub_scalar_lhs(lhs, self)
}
/// Apply lhs / self
#[must_use]
pub fn lhs_div<N: Num + NumCast>(&self, lhs: N) -> Self {
let lhs: T::Native = NumCast::from(lhs).expect("could not cast");
ArithmeticChunked::legacy_div_scalar_lhs(lhs, self)
}
/// Apply lhs % self
#[must_use]
pub fn lhs_rem<N: Num + NumCast>(&self, lhs: N) -> Self {
let lhs: T::Native = NumCast::from(lhs).expect("could not cast");
ArithmeticChunked::wrapping_mod_scalar_lhs(lhs, self)
}
}
View on GitHub (pinned to df599052da)
When it happens
Trigger: Thrown at crates/polars-core/src/series/arithmetic/borrowed.rs:835 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/6b10d56526d9af7e.
Report an issue: GitHub.