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

Function reindex

xarray/structure/alignment.py:1049–1085  ·  view source on GitHub ↗

Re-index either a Dataset or a DataArray. Not public API.

(
    obj: T_Alignable,
    indexers: Mapping[Any, Any],
    method: str | None = None,
    tolerance: float | Iterable[float] | str | None = None,
    copy: bool = True,
    fill_value: Any = dtypes.NA,
    sparse: bool = False,
    exclude_vars: Iterable[Hashable] = frozenset(),
)

Source from the content-addressed store, hash-verified

1047
1048
1049def reindex(
1050 obj: T_Alignable,
1051 indexers: Mapping[Any, Any],
1052 method: str | None = None,
1053 tolerance: float | Iterable[float] | str | None = None,
1054 copy: bool = True,
1055 fill_value: Any = dtypes.NA,
1056 sparse: bool = False,
1057 exclude_vars: Iterable[Hashable] = frozenset(),
1058) -> T_Alignable:
1059 """Re-index either a Dataset or a DataArray.
1060
1061 Not public API.
1062
1063 """
1064
1065 # TODO: (benbovy - explicit indexes): uncomment?
1066 # --> from reindex docstrings: "any mismatched dimension is simply ignored"
1067 # bad_keys = [k for k in indexers if k not in obj._indexes and k not in obj.dims]
1068 # if bad_keys:
1069 # raise ValueError(
1070 # f"indexer keys {bad_keys} do not correspond to any indexed coordinate "
1071 # "or unindexed dimension in the object to reindex"
1072 # )
1073
1074 aligner = Aligner(
1075 (obj,),
1076 indexes=indexers,
1077 method=method,
1078 tolerance=tolerance,
1079 copy=copy,
1080 fill_value=fill_value,
1081 sparse=sparse,
1082 exclude_vars=exclude_vars,
1083 )
1084 aligner.align()
1085 return aligner.results[0]
1086
1087
1088def reindex_like(

Callers 1

reindex_likeFunction · 0.85

Calls 2

alignMethod · 0.95
AlignerClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…