Skip to content

Commit

Permalink
cudf.pandas: Series dt accessor is CombinedDatetimelikeProperties (#1…
Browse files Browse the repository at this point in the history
…5523)

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: #15523
  • Loading branch information
wence- authored Apr 12, 2024
1 parent 6f8ff79 commit 2e00cb1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/cudf/cudf/pandas/_wrappers/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 2e00cb1

Please sign in to comment.