Skip to content

Commit

Permalink
Merge pull request #18008 from mattip/fix1
Browse files Browse the repository at this point in the history
DOC: fix for doctests
  • Loading branch information
charris committed Dec 16, 2020
2 parents 8e038f4 + 768e9e0 commit b639165
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions doc/source/user/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -177,24 +177,24 @@ The function ``zeros`` creates an array full of zeros, the function
``ones`` creates an array full of ones, and the function ``empty``
creates an array whose initial content is random and depends on the
state of the memory. By default, the dtype of the created array is
``float64``.
``float64``, but it can be specified via the key word argument ``dtype``.

::

>>> np.zeros((3, 4))
array([[0., 0., 0., 0.],
[0., 0., 0., 0.],
[0., 0., 0., 0.]])
>>> np.ones((2, 3, 4), dtype=np.int16) # dtype can also be specified
>>> np.ones((2, 3, 4), dtype=np.int16)
array([[[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1]],
<BLANKLINE>
[[1, 1, 1, 1],
[1, 1, 1, 1],
[1, 1, 1, 1]]], dtype=int16)
>>> np.empty((2, 3)) # uninitialized, the result may vary
array([[3.73603959e-262, 6.02658058e-154, 6.55490914e-260],
>>> np.empty((2, 3))
array([[3.73603959e-262, 6.02658058e-154, 6.55490914e-260], # may vary
[5.30498948e-313, 3.14673309e-307, 1.00000000e+000]])

To create sequences of numbers, NumPy provides the ``arange`` function
Expand Down

0 comments on commit b639165

Please sign in to comment.