Skip to content

DataFrame#describe panics on tz-aware datetime columns #130

@wtn

Description

@wtn

describe causes a fatal Rust thread panic when the DataFrame contains a datetime column with a timezone.

Reproduction

df = Polars::DataFrame.new({
"a" => [1, 2, 3],
"ts" => Polars::Series.new("ts", [Time.utc(2026, 1, 1), Time.utc(2026, 1, 2), Time.utc(2026, 1, 3)])
  .cast(Polars::Datetime.new("ms", "Europe/London")),
})
df.describe

thread '<unnamed>' panicked at ext/polars/src/conversion/datetime.rs:11:10:
called `Result::unwrap()` on an `Err` value: Error(Exception(#<Polars::Todo: Polars::Todo>))

Cause

_to_ruby_datetime in lib/polars/utils/convert.rb raises Todo for non-UTC timezones. The Rust caller in datetime_to_rb_object calls .unwrap() on the funcall result, turning the Ruby exception into a fatal panic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions