caterva2.File.fetch#
- File.fetch(slice_=None)#
Fetches a slice of the dataset.
This method is equivalent to __getitem__().
- Parameters:
slice_¶ (int, slice, tuple of ints and slices, or None) – Specifies the slice to fetch.
- Returns:
The requested 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.fetch(1) array(1) >>> ds.fetch(slice(0, 10)) array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])