Slice an array by partitions. Alias of dask array .blocks attribute. This alias allows you to write agnostic code that works with both dask arrays and dask dataframes. This returns a ``Blockview`` object that provides an array-like interface to the blocks of a dask
(self)
| 2136 | |
| 2137 | @property |
| 2138 | def partitions(self): |
| 2139 | """Slice an array by partitions. Alias of dask array .blocks attribute. |
| 2140 | |
| 2141 | This alias allows you to write agnostic code that works with both |
| 2142 | dask arrays and dask dataframes. |
| 2143 | |
| 2144 | This returns a ``Blockview`` object that provides an array-like interface |
| 2145 | to the blocks of a dask array. Numpy-style indexing of a ``Blockview`` object |
| 2146 | returns a selection of blocks as a new dask array. |
| 2147 | |
| 2148 | You can index ``array.blocks`` like a numpy array of shape |
| 2149 | equal to the number of blocks in each dimension, (available as |
| 2150 | array.blocks.size). The dimensionality of the output array matches |
| 2151 | the dimension of this array, even if integer indices are passed. |
| 2152 | Slicing with ``np.newaxis`` or multiple lists is not supported. |
| 2153 | |
| 2154 | Examples |
| 2155 | -------- |
| 2156 | >>> import dask.array as da |
| 2157 | >>> x = da.arange(8, chunks=2) |
| 2158 | >>> x.partitions.shape # aliases x.numblocks |
| 2159 | (4,) |
| 2160 | >>> x.partitions[0].compute() |
| 2161 | array([0, 1]) |
| 2162 | >>> x.partitions[:3].compute() |
| 2163 | array([0, 1, 2, 3, 4, 5]) |
| 2164 | >>> x.partitions[::2].compute() |
| 2165 | array([0, 1, 4, 5]) |
| 2166 | >>> x.partitions[[-1, 0]].compute() |
| 2167 | array([6, 7, 0, 1]) |
| 2168 | >>> x.partitions.ravel() # doctest: +NORMALIZE_WHITESPACE |
| 2169 | [dask.array<blocks, shape=(2,), dtype=int64, chunksize=(2,), chunktype=numpy.ndarray>, |
| 2170 | dask.array<blocks, shape=(2,), dtype=int64, chunksize=(2,), chunktype=numpy.ndarray>, |
| 2171 | dask.array<blocks, shape=(2,), dtype=int64, chunksize=(2,), chunktype=numpy.ndarray>, |
| 2172 | dask.array<blocks, shape=(2,), dtype=int64, chunksize=(2,), chunktype=numpy.ndarray>] |
| 2173 | |
| 2174 | Returns |
| 2175 | ------- |
| 2176 | An instance of ``da.array.Blockview`` |
| 2177 | """ |
| 2178 | return self.blocks |
| 2179 | |
| 2180 | def dot(self, other): |
| 2181 | """Dot product of self and other. |
nothing calls this directly
no outgoing calls
no test coverage detected