(
values: np.ndarray,
*,
axis: AxisInt | None = None,
skipna: bool = True,
**kwds,
)
| 112 | |
| 113 | @functools.wraps(alt) |
| 114 | def f( |
| 115 | values: np.ndarray, |
| 116 | *, |
| 117 | axis: AxisInt | None = None, |
| 118 | skipna: bool = True, |
| 119 | **kwds, |
| 120 | ): |
| 121 | if len(self.kwargs) > 0: |
| 122 | for k, v in self.kwargs.items(): |
| 123 | if k not in kwds: |
| 124 | kwds[k] = v |
| 125 | |
| 126 | if values.size == 0 and kwds.get("min_count") is None: |
| 127 | # We are empty, returning NA for our type |
| 128 | # Only applies for the default `min_count` of None |
| 129 | # since that affects how empty arrays are handled. |
| 130 | # TODO(GH-18976) update all the nanops methods to |
| 131 | # correctly handle empty inputs and remove this check. |
| 132 | # It *may* just be `var` |
| 133 | return _na_for_min_count(values, axis) |
| 134 | |
| 135 | if _USE_BOTTLENECK and skipna and _bn_ok_dtype(values.dtype, bn_name): |
| 136 | if kwds.get("mask", None) is None: |
| 137 | # `mask` is not recognised by bottleneck, would raise |
| 138 | # TypeError if called |
| 139 | kwds.pop("mask", None) |
| 140 | result = bn_func(values, axis=axis, **kwds) |
| 141 | |
| 142 | # prefer to treat inf/-inf as NA, but must compute the func |
| 143 | # twice :( |
| 144 | if _has_infs(result): |
| 145 | result = alt(values, axis=axis, skipna=skipna, **kwds) |
| 146 | else: |
| 147 | result = alt(values, axis=axis, skipna=skipna, **kwds) |
| 148 | else: |
| 149 | result = alt(values, axis=axis, skipna=skipna, **kwds) |
| 150 | |
| 151 | return result |
| 152 | |
| 153 | return cast(F, f) |
| 154 |
nothing calls this directly
no test coverage detected