Skip to content

Commit 75075c8

Browse files
authored
use first element of residual in _nonpolyfit_1d (#8647)
1 parent 15fb1d8 commit 75075c8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

xarray/core/nputils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def _nanpolyfit_1d(arr, x, rcond=None):
234234
mask = np.isnan(arr)
235235
if not np.all(mask):
236236
out[:-1], resid, rank, _ = np.linalg.lstsq(x[~mask, :], arr[~mask], rcond=rcond)
237-
out[-1] = resid if resid.size > 0 else np.nan
237+
out[-1] = resid[0] if resid.size > 0 else np.nan
238238
warn_on_deficient_rank(rank, x.shape[1])
239239
return out
240240

0 commit comments

Comments
 (0)