|
9 | 9 | import datetime
|
10 | 10 | import inspect
|
11 | 11 | import warnings
|
12 |
| -from functools import partial |
13 | 12 | from importlib import import_module
|
14 | 13 |
|
15 | 14 | import numpy as np
|
@@ -637,27 +636,25 @@ def cumsum(array, axis=None, **kwargs):
|
637 | 636 | return _nd_cum_func(cumsum_1d, array, axis, **kwargs)
|
638 | 637 |
|
639 | 638 |
|
640 |
| -_fail_on_dask_array_input_skipna = partial( |
641 |
| - fail_on_dask_array_input, |
642 |
| - msg="%r with skipna=True is not yet implemented on dask arrays", |
643 |
| -) |
644 |
| - |
645 |
| - |
646 | 639 | def first(values, axis, skipna=None):
|
647 | 640 | """Return the first non-NA elements in this array along the given axis"""
|
648 | 641 | if (skipna or skipna is None) and values.dtype.kind not in "iSU":
|
649 | 642 | # only bother for dtypes that can hold NaN
|
650 |
| - _fail_on_dask_array_input_skipna(values) |
651 |
| - return nanfirst(values, axis) |
| 643 | + if is_duck_dask_array(values): |
| 644 | + return dask_array_ops.nanfirst(values, axis) |
| 645 | + else: |
| 646 | + return nanfirst(values, axis) |
652 | 647 | return take(values, 0, axis=axis)
|
653 | 648 |
|
654 | 649 |
|
655 | 650 | def last(values, axis, skipna=None):
|
656 | 651 | """Return the last non-NA elements in this array along the given axis"""
|
657 | 652 | if (skipna or skipna is None) and values.dtype.kind not in "iSU":
|
658 | 653 | # only bother for dtypes that can hold NaN
|
659 |
| - _fail_on_dask_array_input_skipna(values) |
660 |
| - return nanlast(values, axis) |
| 654 | + if is_duck_dask_array(values): |
| 655 | + return dask_array_ops.nanlast(values, axis) |
| 656 | + else: |
| 657 | + return nanlast(values, axis) |
661 | 658 | return take(values, -1, axis=axis)
|
662 | 659 |
|
663 | 660 |
|
|
0 commit comments