feat: Add str, dt accessors to pd.col Expression objects (#2488) · google/bigframes@ce5de57 · GitHub
Skip to content

Commit ce5de57

Browse files
feat: Add str, dt accessors to pd.col Expression objects (#2488)
1 parent 47a0feb commit ce5de57

8 files changed

Lines changed: 174 additions & 109 deletions

File tree

bigframes/core/col.py

Lines changed: 51 additions & 28 deletions

bigframes/core/compile/ibis_compiler/scalar_op_registry.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,9 @@ def isin_op_impl(x: ibis_types.Value, op: ops.IsInOp):
982982

983983
@scalar_op_compiler.register_unary_op(ops.ToDatetimeOp, pass_op=True)
984984
def to_datetime_op_impl(x: ibis_types.Value, op: ops.ToDatetimeOp):
985-
if x.type() in (ibis_dtypes.str, ibis_dtypes.Timestamp("UTC")): # type: ignore
985+
if x.type() == ibis_dtypes.Timestamp(None): # type: ignore
986+
return x # already a timestamp, no-op
987+
elif x.type() in (ibis_dtypes.str, ibis_dtypes.Timestamp("UTC")): # type: ignore
986988
return x.try_cast(ibis_dtypes.Timestamp(None)) # type: ignore
987989
else:
988990
# Numerical inputs.

bigframes/operations/datetime_ops.py

Lines changed: 3 additions & 0 deletions

0 commit comments

Comments
 (0)