File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
tests/expr_and_series/str Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -126,3 +126,16 @@ def replace(
126
126
) -> NoReturn :
127
127
msg = "`replace` is currently not supported for DuckDB"
128
128
raise NotImplementedError (msg )
129
+
130
+ def to_datetime (self : Self , format : str | None ) -> DuckDBExpr : # noqa: A002
131
+ if format is None :
132
+ msg = "Cannot infer format with DuckDB backend"
133
+ raise NotImplementedError (msg )
134
+
135
+ return self ._compliant_expr ._from_call (
136
+ lambda _input : FunctionExpression (
137
+ "strptime" , _input , ConstantExpression (format )
138
+ ),
139
+ "to_datetime" ,
140
+ expr_kind = self ._compliant_expr ._expr_kind ,
141
+ )
Original file line number Diff line number Diff line change 18
18
data = {"a" : ["2020-01-01T12:34:56" ]}
19
19
20
20
21
- def test_to_datetime (constructor : Constructor , request : pytest .FixtureRequest ) -> None :
22
- if "duckdb" in str (constructor ):
23
- request .applymarker (pytest .mark .xfail )
21
+ def test_to_datetime (constructor : Constructor ) -> None :
24
22
if "cudf" in str (constructor ):
25
23
expected = "2020-01-01T12:34:56.000000000"
26
24
else :
You can’t perform that action at this time.
0 commit comments