Skip to content

[BUG]: Bug in cudf-polars to_string for datetime column with timezone #23935

Description

@TomAugspurger

Describe the bug

cudf-polars doesn't match polars to_string when the datetime column has a timezone.

def test_to_string(engine: pl.GPUEngine) -> None:
    data = {
        "a": [
            datetime.datetime(2020, 1, 1, tzinfo=datetime.UTC),
            datetime.datetime(2020, 1, 2, tzinfo=datetime.UTC),
        ]
    }
    df = pl.LazyFrame(data)
    q = df.select(pl.col("a").dt.replace_time_zone(None).dt.convert_time_zone("Asia/Kathmandu"))
    assert_gpu_result_equal(q, engine=engine)

    q2 = q.select(pl.col("a").dt.to_string("%Y-%m-%dT%H:%M%z"))
    assert_gpu_result_equal(q2, engine=engine)

with

AssertionError: DataFrames are different (value mismatch for column "a")
[left]: shape: (2,)
Series: 'a' [str]
[
        "2020-01-01T05:45+0545"
        "2020-01-02T05:45+0545"
]
[right]: shape: (2,)
Series: 'a' [str]
[
        "2020-01-01T00:00+0000"
        "2020-01-02T00:00+0000"
]
=========================================================================================================================================================== short test summary info ============================================================================================================================================================
FAILED python/cudf_polars/tests/expressions/test_datetime_timezone.py::test_to_string[in-memory] - AssertionError: DataFrames are different (value mismatch for column "a")

This is causing CI failures in the narhwals tests: https://github.com/NVIDIA/cudf/actions/runs/33631705030/job/100262514357?pr=23922#step:14:4243

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions