Skip to content

Commit 7f0f235

Browse files
authored
Merge pull request #91 from raisadz/feat/expr-duration
feat: add duration methods
2 parents 5e71570 + 175d711 commit 7f0f235

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

narwhals_daft/expr_dt.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,23 @@ def ordinal_day(self) -> DaftExpr:
5959
def to_string(self, format: str | None) -> DaftExpr:
6060
return self.compliant._with_elementwise(lambda expr: F.strftime(expr, format))
6161

62+
def total_minutes(self) -> DaftExpr:
63+
return self.compliant._with_elementwise(lambda expr: F.total_minutes(expr))
64+
65+
def total_seconds(self) -> DaftExpr:
66+
return self.compliant._with_elementwise(lambda expr: F.total_seconds(expr))
67+
68+
def total_milliseconds(self) -> DaftExpr:
69+
return self.compliant._with_elementwise(lambda expr: F.total_milliseconds(expr))
70+
71+
def total_microseconds(self) -> DaftExpr:
72+
return self.compliant._with_elementwise(lambda expr: F.total_microseconds(expr))
73+
74+
def total_nanoseconds(self) -> DaftExpr:
75+
return self.compliant._with_elementwise(lambda expr: F.total_nanoseconds(expr))
76+
6277
replace_time_zone = not_implemented()
6378
convert_time_zone = not_implemented()
6479
timestamp = not_implemented()
65-
total_minutes = not_implemented()
66-
total_seconds = not_implemented()
67-
total_milliseconds = not_implemented()
68-
total_microseconds = not_implemented()
69-
total_nanoseconds = not_implemented()
7080
truncate = not_implemented()
7181
offset_by = not_implemented()

0 commit comments

Comments
 (0)