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

Method tail

xarray/core/dataarray.py:1780–1825  ·  view source on GitHub ↗

Return a new DataArray whose data is given by the last `n` values along the specified dimension(s). Default `n` = 5 See Also -------- Dataset.tail DataArray.head DataArray.thin Examples -------- >>> da = xr.DataArray(

(
        self,
        indexers: Mapping[Any, int] | int | None = None,
        **indexers_kwargs: Any,
    )

Source from the content-addressed store, hash-verified

1778 return self._from_temp_dataset(ds)
1779
1780 def tail(
1781 self,
1782 indexers: Mapping[Any, int] | int | None = None,
1783 **indexers_kwargs: Any,
1784 ) -> Self:
1785 """Return a new DataArray whose data is given by the last `n`
1786 values along the specified dimension(s). Default `n` = 5
1787
1788 See Also
1789 --------
1790 Dataset.tail
1791 DataArray.head
1792 DataArray.thin
1793
1794 Examples
1795 --------
1796 >>> da = xr.DataArray(
1797 ... np.arange(25).reshape(5, 5),
1798 ... dims=("x", "y"),
1799 ... )
1800 >>> da
1801 <xarray.DataArray (x: 5, y: 5)> Size: 200B
1802 array([[ 0, 1, 2, 3, 4],
1803 [ 5, 6, 7, 8, 9],
1804 [10, 11, 12, 13, 14],
1805 [15, 16, 17, 18, 19],
1806 [20, 21, 22, 23, 24]])
1807 Dimensions without coordinates: x, y
1808
1809 >>> da.tail(y=1)
1810 <xarray.DataArray (x: 5, y: 1)> Size: 40B
1811 array([[ 4],
1812 [ 9],
1813 [14],
1814 [19],
1815 [24]])
1816 Dimensions without coordinates: x, y
1817
1818 >>> da.tail({"x": 2, "y": 2})
1819 <xarray.DataArray (x: 2, y: 2)> Size: 32B
1820 array([[18, 19],
1821 [23, 24]])
1822 Dimensions without coordinates: x, y
1823 """
1824 ds = self._to_temp_dataset().tail(indexers, **indexers_kwargs)
1825 return self._from_temp_dataset(ds)
1826
1827 def thin(
1828 self,

Callers

nothing calls this directly

Calls 2

_to_temp_datasetMethod · 0.95
_from_temp_datasetMethod · 0.95

Tested by

no test coverage detected