Skip to content

Commit 7e7be3c

Browse files
authored
Merge branch 'main' into refac-native-module
2 parents d060577 + baabbf4 commit 7e7be3c

File tree

25 files changed

+315
-31
lines changed

25 files changed

+315
-31
lines changed

.github/workflows/pytest.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ jobs:
5353
cache-dependency-glob: "pyproject.toml"
5454
- name: install-reqs
5555
# we are not testing pyspark on Windows here because it is very slow
56-
# TODO(FBruzzesi): Unpin duckdb version once ibis makes a new release
57-
run: uv pip install -e ".[dask, modin, ibis]" --group core-tests --group extra "duckdb<1.4" --system
56+
run: uv pip install -e ".[dask, modin, ibis]" --group core-tests --group extra --system
5857
- name: show-deps
5958
run: uv pip freeze
6059
- name: Run pytest
@@ -84,8 +83,7 @@ jobs:
8483
cache-suffix: pytest-full-coverage-${{ matrix.python-version }}
8584
cache-dependency-glob: "pyproject.toml"
8685
- name: install-reqs
87-
# TODO(FBruzzesi): Unpin duckdb version once ibis makes a new release
88-
run: uv pip install -e ".[dask, modin, ibis]" --group core-tests --group extra "duckdb<1.4" --system
86+
run: uv pip install -e ".[dask, modin, ibis]" --group core-tests --group extra --system
8987
- name: show-deps
9088
run: uv pip freeze
9189
- name: Run pytest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ dist/
1313
coverage.xml
1414
.hypothesis/
1515
.pytest_cache/
16+
.mypy_cache
1617

1718
# Documentation
1819
site/

docs/api-reference/expr.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- all
1010
- any
1111
- cast
12+
- ceil
1213
- clip
1314
- count
1415
- cum_count
@@ -24,6 +25,7 @@
2425
- fill_null
2526
- filter
2627
- first
28+
- floor
2729
- is_between
2830
- is_close
2931
- is_duplicated

docs/api-reference/series.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
- arg_min
1616
- arg_true
1717
- cast
18+
- ceil
1819
- clip
1920
- count
2021
- cum_count
@@ -31,6 +32,7 @@
3132
- fill_null
3233
- filter
3334
- first
35+
- floor
3436
- from_iterable
3537
- from_numpy
3638
- gather_every

narwhals/_arrow/series.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,12 @@ def round(self, decimals: int) -> Self:
516516
pc.round(self.native, decimals, round_mode="half_towards_infinity")
517517
)
518518

519+
def floor(self) -> Self:
520+
return self._with_native(pc.floor(self.native))
521+
522+
def ceil(self) -> Self:
523+
return self._with_native(pc.ceil(self.native))
524+
519525
def diff(self) -> Self:
520526
return self._with_native(pc.pairwise_diff(self.native.combine_chunks()))
521527

narwhals/_compliant/column.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ def rolling_var(
198198
self, window_size: int, *, min_samples: int, center: bool, ddof: int
199199
) -> Self: ...
200200
def round(self, decimals: int) -> Self: ...
201+
def floor(self) -> Self: ...
202+
def ceil(self) -> Self: ...
201203
def shift(self, n: int) -> Self: ...
202204
def unique(self) -> Self: ...
203205

narwhals/_compliant/expr.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,12 @@ def tail(self, n: int) -> Self:
709709
def round(self, decimals: int) -> Self:
710710
return self._reuse_series("round", decimals=decimals)
711711

712+
def floor(self) -> Self:
713+
return self._reuse_series("floor")
714+
715+
def ceil(self) -> Self:
716+
return self._reuse_series("ceil")
717+
712718
def len(self) -> Self:
713719
return self._reuse_series("len", returns_scalar=True)
714720

narwhals/_dask/expr.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,16 @@ def count(self) -> Self:
445445
def round(self, decimals: int) -> Self:
446446
return self._with_callable(lambda expr: expr.round(decimals), "round")
447447

448+
def floor(self) -> Self:
449+
import dask.array as da
450+
451+
return self._with_callable(da.floor, "floor")
452+
453+
def ceil(self) -> Self:
454+
import dask.array as da
455+
456+
return self._with_callable(da.ceil, "ceil")
457+
448458
def unique(self) -> Self:
449459
return self._with_callable(lambda expr: expr.unique(), "unique")
450460

narwhals/_dask/group_by.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
else:
2828
try:
2929
import dask.dataframe.dask_expr as dx
30-
except ModuleNotFoundError: # pragma: no cover
30+
except ModuleNotFoundError:
3131
import dask_expr as dx
3232
_DaskGroupBy = dx._groupby.GroupBy
3333

narwhals/_dask/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
else:
2020
try:
2121
import dask.dataframe.dask_expr as dx
22-
except ModuleNotFoundError: # pragma: no cover
22+
except ModuleNotFoundError:
2323
import dask_expr as dx
2424

2525

0 commit comments

Comments
 (0)