MCPcopy
hub / github.com/pydata/xarray / reindex

Method reindex

xarray/core/dataset.py:3493–3707  ·  view source on GitHub ↗

Conform this object onto a new set of indexes, filling in missing values with ``fill_value``. The default fill value is NaN. Parameters ---------- indexers : dict, optional Dictionary with keys given by dimension names and values given by arra

(
        self,
        indexers: Mapping[Any, Any] | None = None,
        method: ReindexMethodOptions = None,
        tolerance: float | Iterable[float] | str | None = None,
        copy: bool = True,
        fill_value: Any = xrdtypes.NA,
        **indexers_kwargs: Any,
    )

Source from the content-addressed store, hash-verified

3491 )
3492
3493 def reindex(
3494 self,
3495 indexers: Mapping[Any, Any] | None = None,
3496 method: ReindexMethodOptions = None,
3497 tolerance: float | Iterable[float] | str | None = None,
3498 copy: bool = True,
3499 fill_value: Any = xrdtypes.NA,
3500 **indexers_kwargs: Any,
3501 ) -> Self:
3502 """Conform this object onto a new set of indexes, filling in
3503 missing values with ``fill_value``. The default fill value is NaN.
3504
3505 Parameters
3506 ----------
3507 indexers : dict, optional
3508 Dictionary with keys given by dimension names and values given by
3509 arrays of coordinates tick labels. Any mismatched coordinate
3510 values will be filled in with NaN, and any mismatched dimension
3511 names will simply be ignored.
3512 One of indexers or indexers_kwargs must be provided.
3513 method : {None, "nearest", "pad", "ffill", "backfill", "bfill", None}, optional
3514 Method to use for filling index values in ``indexers`` not found in
3515 this dataset:
3516
3517 - None (default): don't fill gaps
3518 - "pad" / "ffill": propagate last valid index value forward
3519 - "backfill" / "bfill": propagate next valid index value backward
3520 - "nearest": use nearest valid index value
3521
3522 tolerance : float | Iterable[float] | str | None, default: None
3523 Maximum distance between original and new labels for inexact
3524 matches. The values of the index at the matching locations must
3525 satisfy the equation ``abs(index[indexer] - target) <= tolerance``.
3526 Tolerance may be a scalar value, which applies the same tolerance
3527 to all values, or list-like, which applies variable tolerance per
3528 element. List-like must be the same size as the index and its dtype
3529 must exactly match the index’s type.
3530 copy : bool, default: True
3531 If ``copy=True``, data in the return value is always copied. If
3532 ``copy=False`` and reindexing is unnecessary, or can be performed
3533 with only slice operations, then the output may share memory with
3534 the input. In either case, a new xarray object is always returned.
3535 fill_value : scalar or dict-like, optional
3536 Value to use for newly missing values. If a dict-like,
3537 maps variable names (including coordinates) to fill values.
3538 sparse : bool, default: False
3539 use sparse-array.
3540 **indexers_kwargs : {dim: indexer, ...}, optional
3541 Keyword arguments in the same form as ``indexers``.
3542 One of indexers or indexers_kwargs must be provided.
3543
3544 Returns
3545 -------
3546 reindexed : Dataset
3547 Another dataset, with this dataset&#x27;s data but replaced coordinates.
3548
3549 See Also
3550 --------

Calls

no outgoing calls