{"record":{"id":"6b10d56526d9af7e","repo":"pola-rs/polars","slug":"could-not-cast","errorCode":null,"errorMessage":"could not cast","messagePattern":"could not cast","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-core/src/series/arithmetic/borrowed.rs","lineNumber":835,"sourceCode":"impl<T> Rem<T> for Series\nwhere\n    T: Num + NumCast,\n{\n    type Output = Self;\n\n    fn rem(self, rhs: T) -> Self::Output {\n        (&self).rem(rhs)\n    }\n}\n\n/// We cannot override the left hand side behaviour. So we create a trait LhsNumOps.\n/// This allows for 1.add(&Series)\n///\nimpl<T: PolarsNumericType> ChunkedArray<T> {\n    /// Apply lhs - self\n    #[must_use]\n    pub fn lhs_sub<N: Num + NumCast>(&self, lhs: N) -> Self {\n        let lhs: T::Native = NumCast::from(lhs).expect(\"could not cast\");\n        ArithmeticChunked::wrapping_sub_scalar_lhs(lhs, self)\n    }\n\n    /// Apply lhs / self\n    #[must_use]\n    pub fn lhs_div<N: Num + NumCast>(&self, lhs: N) -> Self {\n        let lhs: T::Native = NumCast::from(lhs).expect(\"could not cast\");\n        ArithmeticChunked::legacy_div_scalar_lhs(lhs, self)\n    }\n\n    /// Apply lhs % self\n    #[must_use]\n    pub fn lhs_rem<N: Num + NumCast>(&self, lhs: N) -> Self {\n        let lhs: T::Native = NumCast::from(lhs).expect(\"could not cast\");\n        ArithmeticChunked::wrapping_mod_scalar_lhs(lhs, self)\n    }\n}\n","sourceCodeStart":817,"sourceCodeEnd":853,"githubUrl":"https://github.com/pola-rs/polars/blob/df599052daf96e7a9cc30a3b0c6bd25d6947e3c0/crates/polars-core/src/series/arithmetic/borrowed.rs#L817-L853","documentation":"Error \"could not cast\" thrown in pola-rs/polars.","triggerScenarios":"Thrown at crates/polars-core/src/series/arithmetic/borrowed.rs:835 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"df599052daf96e7a9cc30a3b0c6bd25d6947e3c0","analyzedAt":"2026-08-16T12:10:03.978Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}