pola-rs/polars · error

date not implemented for

Error message

date not implemented for {dt:?}

What it means

Series::into_time only supports conversion from Int64 physical values or an existing Time dtype; any other dtype (e.g. Date, Datetime, Utf8) hits the catch-all panic — this conversion path simply does not implement a cast from that dtype to Time.

Solutions

  1. Ensure the column is Int64 physical nanoseconds (cast first: .cast(&DataType::Int64)) before into_time()
  2. Use the safe cast API: series.strict_cast(&DataType::Time) instead of into_time
  3. Parse strings into time with str.to_time (temporal namespace) rather than into_time

Example fix

// before
let s = series.into_time(); // panics for Int32
// after
let s = series.cast(&DataType::Int64)?.into_time();
Defensive patterns

Strategy: type-guard

Validate before calling

if !matches!(s.dtype(), DataType::Int64 | DataType::Time) { /* convert first */ }

Type guard

fn time_convertible(dt: &DataType) -> bool { matches!(dt, DataType::Int64 | DataType::Time) }

Try / catch

let s: PolarsResult<Series> = series.strict_cast(&DataType::Time);

Prevention

When it happens

Trigger: Calling into_time() on a series whose dtype is neither Int64 nor DataType::Time (e.g. Int32, Datetime, String).

Common situations: Attempting to reinterpret datetime or string columns as Time directly; feature dtype-time enabled but the column was parsed as Int32 microseconds instead of Int64 nanos.

Related errors


AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18). Data as JSON: /api/errors/f59ee5963d703db3. Report an issue: GitHub.

Appendix: source

Thrown at crates/polars-core/src/series/mod.rs:952

            {
                Ok(self)
            },
            dt => panic!("into_decimal({precision:?}, {scale}) not implemented for {dt:?}"),
        }
    }

    #[cfg(feature = "dtype-time")]
    pub fn into_time(self) -> Series {
        match self.dtype() {
            DataType::Int64 => self.i64().unwrap().clone().into_time().into_series(),
            DataType::Time => self
                .time()
                .unwrap()
                .physical()
                .clone()
                .into_time()
                .into_series(),
            dt => panic!("date not implemented for {dt:?}"),
        }
    }

    pub fn into_date(self) -> Series {
        #[cfg(not(feature = "dtype-date"))]
        {
            panic!("activate feature dtype-date")
        }
        #[cfg(feature = "dtype-date")]
        match self.dtype() {
            DataType::Int32 => self.i32().unwrap().clone().into_date().into_series(),
            DataType::Date => self
                .date()
                .unwrap()
                .physical()
                .clone()
                .into_date()
                .into_series(),

View on GitHub (pinned to fe841f959e)