MCPcopy Index your code
hub / github.com/pydata/xarray / _push

Function _push

xarray/core/duck_array_ops.py:863–883  ·  view source on GitHub ↗

Use either bottleneck or numbagg depending on options & what's available

(array, n: int | None = None, axis: int = -1)

Source from the content-addressed store, hash-verified

861
862
863def _push(array, n: int | None = None, axis: int = -1):
864 """
865 Use either bottleneck or numbagg depending on options & what's available
866 """
867
868 if not OPTIONS["use_bottleneck"] and not OPTIONS["use_numbagg"]:
869 raise RuntimeError(
870 "ffill & bfill requires bottleneck or numbagg to be enabled."
871 " Call `xr.set_options(use_bottleneck=True)` or `xr.set_options(use_numbagg=True)` to enable one."
872 )
873 if OPTIONS["use_numbagg"] and module_available("numbagg"):
874 import numbagg # type: ignore[import-not-found, unused-ignore]
875
876 return numbagg.ffill(array, limit=n, axis=axis)
877
878 # work around for bottleneck 178
879 limit = n if n is not None else array.shape[axis]
880
881 import bottleneck as bn
882
883 return bn.push(array, limit, axis)
884
885
886def push(array, n, axis, method="blelloch"):

Callers 2

_dtype_pushFunction · 0.90
pushFunction · 0.85

Calls 2

module_availableFunction · 0.90
ffillMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…