Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mrocklin committed Mar 20, 2017
1 parent e4cc6b4 commit bc5ea71
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docs/source/array-creation.rst
Expand Up @@ -87,6 +87,34 @@ track the number of rows in each partition) and so some operations like slicing
will not operate correctly.
Interactions with NumPy arrays
------------------------------
Dask.array operations will automatically convert NumPy arrays into single-chunk
dask arrays
.. code-block:: python
>>> x = da.sum(np.ones(5))
>>> x.compute()
5
When NumPy and Dask arrays interact the result will be a Dask array. Automatic
rechunking rules will generally slice the NumPy array into the appropriate Dask
chunk shape
.. code-block:: python
>>> x = da.ones(10, chunks=(5,))
>>> y = np.ones(10)
>>> z = x + y
>>> z
dask.array<add, shape=(10,), dtype=float64, chunksize=(5,)>
These interactions work not just for NumPy arrays, but for any object that has
shape and dtype attributes and implements NumPy slicing syntax.
Chunks
------
Expand Down

0 comments on commit bc5ea71

Please sign in to comment.