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

Method reindex

xarray/core/dataarray.py:2175–2265  ·  view source on GitHub ↗

Conform this object onto the indexes of another object, 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

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

Source from the content-addressed store, hash-verified

2173 )
2174
2175 def reindex(
2176 self,
2177 indexers: Mapping[Any, Any] | None = None,
2178 *,
2179 method: ReindexMethodOptions = None,
2180 tolerance: float | Iterable[float] | str | None = None,
2181 copy: bool = True,
2182 fill_value=dtypes.NA,
2183 **indexers_kwargs: Any,
2184 ) -> Self:
2185 """Conform this object onto the indexes of another object, filling in
2186 missing values with ``fill_value``. The default fill value is NaN.
2187
2188 Parameters
2189 ----------
2190 indexers : dict, optional
2191 Dictionary with keys given by dimension names and values given by
2192 arrays of coordinates tick labels. Any mismatched coordinate
2193 values will be filled in with NaN, and any mismatched dimension
2194 names will simply be ignored.
2195 One of indexers or indexers_kwargs must be provided.
2196 copy : bool, optional
2197 If ``copy=True``, data in the return value is always copied. If
2198 ``copy=False`` and reindexing is unnecessary, or can be performed
2199 with only slice operations, then the output may share memory with
2200 the input. In either case, a new xarray object is always returned.
2201 method : {None, 'nearest', 'pad'/'ffill', 'backfill'/'bfill'}, optional
2202 Method to use for filling index values in ``indexers`` not found on
2203 this data array:
2204
2205 - None (default): don't fill gaps
2206 - pad / ffill: propagate last valid index value forward
2207 - backfill / bfill: propagate next valid index value backward
2208 - nearest: use nearest valid index value
2209
2210 tolerance : float | Iterable[float] | str | None, default: None
2211 Maximum distance between original and new labels for inexact
2212 matches. The values of the index at the matching locations must
2213 satisfy the equation ``abs(index[indexer] - target) <= tolerance``.
2214 Tolerance may be a scalar value, which applies the same tolerance
2215 to all values, or list-like, which applies variable tolerance per
2216 element. List-like must be the same size as the index and its dtype
2217 must exactly match the index’s type.
2218 fill_value : scalar or dict-like, optional
2219 Value to use for newly missing values. If a dict-like, maps
2220 variable names (including coordinates) to fill values. Use this
2221 data array's name to refer to the data array's values.
2222 **indexers_kwargs : {dim: indexer, ...}, optional
2223 The keyword arguments form of ``indexers``.
2224 One of indexers or indexers_kwargs must be provided.
2225
2226 Returns
2227 -------
2228 reindexed : DataArray
2229 Another dataset array, with this array&#x27;s data but replaced
2230 coordinates.
2231
2232 Examples

Callers 6

test_upsampleMethod · 0.95
test_reindex_methodMethod · 0.95

Calls

no outgoing calls

Tested by 6

test_upsampleMethod · 0.76
test_reindex_methodMethod · 0.76