diff options
author | Pauli Virtanen <pav@iki.fi> | 2009-10-02 19:27:46 +0000 |
---|---|---|
committer | Pauli Virtanen <pav@iki.fi> | 2009-10-02 19:27:46 +0000 |
commit | 1521f6689a3cc48d60a75097a7ffcf4d51f9dc47 (patch) | |
tree | a0f048838717b7ee43177007ec42c3102ea7be25 /numpy/core/numeric.py | |
parent | 8c7d1bc554e6b5bbb7900a2f6d976d72795bb454 (diff) | |
download | numpy-1521f6689a3cc48d60a75097a7ffcf4d51f9dc47.tar.gz |
Docstring updates, part 1
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r-- | numpy/core/numeric.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index c961bcc0f..abe26aac3 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -48,14 +48,14 @@ ufunc = type(sin) # originally from Fernando Perez's IPython def zeros_like(a): """ - Returns an array of zeros with the same shape and type as a given array. + Return an array of zeros with the same shape and type as a given array. Equivalent to ``a.copy().fill(0)``. Parameters ---------- a : array_like - The shape and data-type of `a` defines the parameters of + The shape and data-type of `a` define the parameters of the returned array. Returns @@ -65,11 +65,11 @@ def zeros_like(a): See Also -------- - numpy.ones_like : Return an array of ones with shape and type of input. - numpy.empty_like : Return an empty array with shape and type of input. - numpy.zeros : Return a new array setting values to zero. - numpy.ones : Return a new array setting values to one. - numpy.empty : Return a new uninitialized array. + ones_like : Return an array of ones with shape and type of input. + empty_like : Return an empty array with shape and type of input. + zeros : Return a new array setting values to zero. + ones : Return a new array setting values to one. + empty : Return a new uninitialized array. Examples -------- @@ -82,6 +82,12 @@ def zeros_like(a): array([[0, 0, 0], [0, 0, 0]]) + >>> y = np.arange(3, dtype=np.float) + >>> y + array([ 0., 1., 2.]) + >>> np.zeros_like(y) + array([ 0., 0., 0.]) + """ if isinstance(a, ndarray): res = ndarray.__new__(type(a), a.shape, a.dtype, order=a.flags.fnc) |