Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions python/cudf/cudf/pandas/_wrappers/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
import abc
import copyreg
import datetime
import functools
import importlib
import inspect
Expand Down Expand Up @@ -183,6 +184,7 @@ def Timestamp_Timedelta__new__(cls, *args, **kwargs):
"Timedelta",
_Unusable,
pd.Timedelta,
bases=(datetime.timedelta,),
fast_to_slow=_Unusable(),
slow_to_fast=_Unusable(),
additional_attributes={
Expand All @@ -197,6 +199,7 @@ def Timestamp_Timedelta__new__(cls, *args, **kwargs):
"Timestamp",
_Unusable,
pd.Timestamp,
bases=(datetime.datetime,),
fast_to_slow=_Unusable(),
slow_to_fast=_Unusable(),
additional_attributes={
Expand Down
23 changes: 23 additions & 0 deletions python/cudf/cudf/pandas/fast_slow_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from __future__ import annotations

import datetime
import functools
import inspect
import operator
Expand Down Expand Up @@ -595,6 +596,26 @@ def _fsproxy_wrap(cls, value, func):
proxy = base_class.__new__(cls)
elif base_class is ProxyNDarrayBase:
proxy = base_class.__new__(cls, value)
elif base_class is datetime.datetime:
proxy = base_class.__new__(
cls,
year=value.year,
month=value.month,
day=value.day,
hour=value.hour,
minute=value.minute,
second=value.second,
microsecond=value.microsecond,
tzinfo=value.tzinfo,
fold=value.fold,
)
elif base_class is datetime.timedelta:
proxy = base_class.__new__(
cls,
days=value.days,
seconds=value.seconds,
microseconds=value.microseconds,
)
else:
raise TypeError(
f"Cannot create an proxy instance of {cls.__name__} using base class {base_class.__name__}. "
Expand Down Expand Up @@ -1384,6 +1405,8 @@ def is_proxy_instance(obj, type):

PROXY_BASE_CLASSES: set[type] = {
ProxyNDarrayBase,
datetime.datetime,
datetime.timedelta,
}


Expand Down
Loading
Loading