-
Notifications
You must be signed in to change notification settings - Fork 915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] AttributeError: type object 'DatetimeProperties' has no attribute 'components' #15522
Comments
Let me look, it should be possible to fix this in the cudf.pandas wrapper magic. |
Simpler repro:
|
Can you try: diff --git a/python/cudf/cudf/pandas/_wrappers/pandas.py b/python/cudf/cudf/pandas/_wrappers/pandas.py
index b7c8e92e8d..3c82d57193 100644
--- a/python/cudf/cudf/pandas/_wrappers/pandas.py
+++ b/python/cudf/cudf/pandas/_wrappers/pandas.py
@@ -174,7 +174,7 @@ Series = make_final_proxy_type(
"__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 @@ Index = make_final_proxy_type(
"__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, |
This showed up a problem in our pandas wrappers in cudf.pandas (which the above patch fixes), but when we merged dask/dask#11035 we accidentally dropped some exception handling, that I reinstate in dask/dask#11049 |
Thanks @wence- , yes, using the patch from #15522 (comment) the code completes without errors in my docker+conda environment. Could you submit a PR for that? |
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 rapidsai#15522
…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
Describe the bug
This is likely a manifestation of the same issue from Python 3.11.9 changes that was observed in Dask which was fixed in dask/dask#11035 .
Error stack
Steps/Code to reproduce bug
Expected behavior
The code should complete without errors.
Environment overview (please complete the following information)
Environment details
Click here to see environment details
The text was updated successfully, but these errors were encountered: