Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 5 additions & 1 deletion dask_expr/_expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
M,
apply,
funcname,
get_meta_library,
has_keyword,
is_arraylike,
partial_by_order,
Expand Down Expand Up @@ -1448,7 +1449,10 @@ class ToDatetime(Elemwise):
_parameters = ["frame", "kwargs", "meta"]
_defaults = {"kwargs": None}
_keyword_only = ["kwargs", "meta"]
operation = staticmethod(pd.to_datetime)

@staticmethod
def operation(*args, **kwargs):
return get_meta_library(args[0]).to_datetime(*args, **kwargs)

@functools.cached_property
def _kwargs(self):
Expand Down
10 changes: 6 additions & 4 deletions dask_expr/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from dask import config
from dask.base import normalize_token, tokenize
from dask.dataframe._compat import is_string_dtype
from dask.dataframe.core import is_dask_collection, is_dataframe_like, is_series_like
from dask.utils import get_default_shuffle_method
from packaging.version import Version

Expand Down Expand Up @@ -173,10 +174,11 @@ def normalize_data_wrapper(data):
def _maybe_from_pandas(dfs):
from dask_expr import from_pandas

dfs = [
from_pandas(df, 1) if isinstance(df, (pd.Series, pd.DataFrame)) else df
for df in dfs
]
def _pd_series_or_dataframe(x):
# `x` can be a cudf Series/DataFrame
return not is_dask_collection(x) and (is_series_like(x) or is_dataframe_like(x))

dfs = [from_pandas(df, 1) if _pd_series_or_dataframe(df) else df for df in dfs]
return dfs


Expand Down