caterva2.Dataset.__getitem__#

Dataset.__getitem__(slice_)#

Get a slice of the dataset.

Parameters:

slice_ (int, slice, tuple of ints and slices, or None) – The slice to fetch.

Returns:

The slice of the dataset.

Return type:

numpy.ndarray

Examples

>>> import caterva2 as cat2
>>> root = cat2.Root('example', 'https://demo.caterva2.net')
>>> ds = root['ds-1d.b2nd']
>>> ds[1]
array(1)
>>> ds[:1]
array([0])
>>> ds[0:10]
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])