From 2e00cb1ebd7bee4a4085d1e691ad3b626bc10d0e Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Fri, 12 Apr 2024 18:06:27 +0100 Subject: [PATCH] cudf.pandas: Series dt accessor is CombinedDatetimelikeProperties (#15523) On the pandas Series type (not an instance) the dt attribute returns a CombinedDatetimelikeProperties object, which advertises the attributes of all possible datetime like dtypes. Previously we were proxying this with a DatatimeProperties object, which doesn't advertise as many properties. To allow wrapping libraries like dask that introspect the object to work correctly, advertise like pandas on the type. The instance still produces an object of the correct type due to dynamic lookup and/or metaclass magic in cudf.pandas and pandas respectively. - Closes #15522 Authors: - Lawrence Mitchell (https://github.com/wence-) Approvers: - Peter Andreas Entschev (https://github.com/pentschev) - GALI PREM SAGAR (https://github.com/galipremsagar) URL: https://github.com/rapidsai/cudf/pull/15523 --- python/cudf/cudf/pandas/_wrappers/pandas.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/cudf/cudf/pandas/_wrappers/pandas.py b/python/cudf/cudf/pandas/_wrappers/pandas.py index b7c8e92e8db..3c82d571939 100644 --- a/python/cudf/cudf/pandas/_wrappers/pandas.py +++ b/python/cudf/cudf/pandas/_wrappers/pandas.py @@ -174,7 +174,7 @@ def _DataFrame__dir__(self): "__arrow_array__": arrow_array_method, "__cuda_array_interface__": cuda_array_interface, "__iter__": custom_iter, - "dt": _AccessorAttr(DatetimeProperties), + "dt": _AccessorAttr(CombinedDatetimelikeProperties), "str": _AccessorAttr(StringMethods), "cat": _AccessorAttr(_CategoricalAccessor), "_constructor": _FastSlowAttribute("_constructor"), @@ -208,7 +208,7 @@ def Index__new__(cls, *args, **kwargs): "__array_function__": array_function_method, "__arrow_array__": arrow_array_method, "__cuda_array_interface__": cuda_array_interface, - "dt": _AccessorAttr(DatetimeProperties), + "dt": _AccessorAttr(CombinedDatetimelikeProperties), "str": _AccessorAttr(StringMethods), "cat": _AccessorAttr(_CategoricalAccessor), "__iter__": custom_iter,