|
12 | 12 | import warnings |
13 | 13 | from functools import partial |
14 | 14 | from importlib import import_module |
| 15 | +from typing import Callable |
15 | 16 |
|
16 | 17 | import numpy as np |
17 | 18 | import pandas as pd |
18 | 19 | from numpy import all as array_all # noqa |
19 | 20 | from numpy import any as array_any # noqa |
| 21 | +from numpy import concatenate as _concatenate |
20 | 22 | from numpy import ( # noqa |
21 | | - around, # noqa |
22 | 23 | full_like, |
23 | 24 | gradient, |
24 | 25 | isclose, |
|
29 | 30 | transpose, |
30 | 31 | unravel_index, |
31 | 32 | ) |
32 | | -from numpy import concatenate as _concatenate |
33 | 33 | from numpy.lib.stride_tricks import sliding_window_view # noqa |
34 | 34 | from packaging.version import Version |
35 | 35 | from pandas.api.types import is_extension_array_dtype |
@@ -122,37 +122,13 @@ def fail_on_dask_array_input(values, msg=None, func_name=None): |
122 | 122 | # Requires special-casing because pandas won't automatically dispatch to dask.isnull via NEP-18 |
123 | 123 | pandas_isnull = _dask_or_eager_func("isnull", eager_module=pd, dask_module="dask.array") |
124 | 124 |
|
125 | | -# np.around has failing doctests, overwrite it so they pass: |
126 | | -# https://github.com/numpy/numpy/issues/19759 |
127 | | -around.__doc__ = str.replace( |
128 | | - around.__doc__ or "", |
129 | | - "array([0., 2.])", |
130 | | - "array([0., 2.])", |
131 | | -) |
132 | | -around.__doc__ = str.replace( |
133 | | - around.__doc__ or "", |
134 | | - "array([0., 2.])", |
135 | | - "array([0., 2.])", |
136 | | -) |
137 | | -around.__doc__ = str.replace( |
138 | | - around.__doc__ or "", |
139 | | - "array([0.4, 1.6])", |
140 | | - "array([0.4, 1.6])", |
141 | | -) |
142 | | -around.__doc__ = str.replace( |
143 | | - around.__doc__ or "", |
144 | | - "array([0., 2., 2., 4., 4.])", |
145 | | - "array([0., 2., 2., 4., 4.])", |
146 | | -) |
147 | | -around.__doc__ = str.replace( |
148 | | - around.__doc__ or "", |
149 | | - ( |
150 | | - ' .. [2] "How Futile are Mindless Assessments of\n' |
151 | | - ' Roundoff in Floating-Point Computation?", William Kahan,\n' |
152 | | - " https://people.eecs.berkeley.edu/~wkahan/Mindless.pdf\n" |
153 | | - ), |
154 | | - "", |
155 | | -) |
| 125 | + |
| 126 | +def round(array): |
| 127 | + xp = get_array_namespace(array) |
| 128 | + return xp.round(array) |
| 129 | + |
| 130 | + |
| 131 | +around: Callable = round |
156 | 132 |
|
157 | 133 |
|
158 | 134 | def isnull(data): |
|
0 commit comments