diff options
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/code_generators/ufunc_docstrings.py | 4 | ||||
-rw-r--r-- | numpy/core/defchararray.py | 11 | ||||
-rw-r--r-- | numpy/core/fromnumeric.py | 2 | ||||
-rw-r--r-- | numpy/core/memmap.py | 15 | ||||
-rw-r--r-- | numpy/core/numeric.py | 24 |
5 files changed, 33 insertions, 23 deletions
diff --git a/numpy/core/code_generators/ufunc_docstrings.py b/numpy/core/code_generators/ufunc_docstrings.py index 2e1cdd460..8d7b83239 100644 --- a/numpy/core/code_generators/ufunc_docstrings.py +++ b/numpy/core/code_generators/ufunc_docstrings.py @@ -71,7 +71,7 @@ add_newdoc('numpy.core.umath', 'add', Returns ------- - y : ndarray or scalar + add : ndarray or scalar The sum of `x1` and `x2`, element-wise. Returns a scalar if both `x1` and `x2` are scalars. @@ -173,7 +173,7 @@ add_newdoc('numpy.core.umath', 'arccosh', Returns ------- - y : ndarray + arccosh : ndarray Array of the same shape as `x`. See Also diff --git a/numpy/core/defchararray.py b/numpy/core/defchararray.py index 850e2dae2..a7b3fd1b7 100644 --- a/numpy/core/defchararray.py +++ b/numpy/core/defchararray.py @@ -265,12 +265,14 @@ def add(x1, x2): Parameters ---------- x1 : array_like of str or unicode + x2 : array_like of str or unicode Returns ------- - out : ndarray + add : ndarray Output array of `string_` or `unicode_`, depending on input types + """ arr1 = numpy.asarray(x1) arr2 = numpy.asarray(x2) @@ -608,14 +610,16 @@ def expandtabs(a, tabsize=8): Return a copy of each string element where all tab characters are replaced by one or more spaces, depending on the current column and the given `tabsize`. The column number is reset to zero after - each newline occurring in the string. If `tabsize` is not given, a - tab size of 8 characters is assumed. This doesn't understand other + each newline occurring in the string. This doesn't understand other non-printing characters or escape sequences. Parameters ---------- a : array_like of str or unicode + Input array tabsize : int, optional + Replace tabs with `tabsize` number of spaces. If not given defaults + to 8 spaces. Returns ------- @@ -625,6 +629,7 @@ def expandtabs(a, tabsize=8): See also -------- str.expandtabs + """ return _to_string_or_unicode_array( _vec_string(a, object_, 'expandtabs', (tabsize,))) diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index 8e7a556ac..8757b85bf 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -1986,7 +1986,7 @@ def alen(a): Returns ------- - l : int + alen : int Length of the first dimension of `a`. See Also diff --git a/numpy/core/memmap.py b/numpy/core/memmap.py index 1ab9f87fc..53f9a3f07 100644 --- a/numpy/core/memmap.py +++ b/numpy/core/memmap.py @@ -60,11 +60,16 @@ class memmap(ndarray): Default is 'r+'. offset : int, optional In the file, array data starts at this offset. Since `offset` is - measured in bytes, it should be a multiple of the byte-size of - `dtype`. Requires ``shape=None``. The default is 0. + measured in bytes, it should normally be a multiple of the byte-size + of `dtype`. When ``mode != 'r'``, even positive offsets beyond end of + file are valid; The file will be extended to accommodate the + additional data. The default offset is 0. shape : tuple, optional - The desired shape of the array. By default, the returned array will be - 1-D with the number of elements determined by file size and data-type. + The desired shape of the array. If ``mode == 'r'`` and the number + of remaining bytes after `offset` is not a multiple of the byte-size + of `dtype`, you must specify `shape`. By default, the returned array + will be 1-D with the number of elements determined by file size + and data-type. order : {'C', 'F'}, optional Specify the order of the ndarray memory layout: C (row-major) or Fortran (column-major). This only has an effect if the shape is @@ -79,7 +84,6 @@ class memmap(ndarray): mode : str File mode. - Methods ------- close @@ -89,6 +93,7 @@ class memmap(ndarray): When you delete a memmap object, flush is called first to write changes to disk before removing the object. + Notes ----- The memmap object can be used anywhere an ndarray is accepted. diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index ba8fc1f52..bb13d573e 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -1663,12 +1663,11 @@ def fromfunction(function, shape, **kwargs): Parameters ---------- function : callable - The function is called with N parameters, each of which - represents the coordinates of the array varying along a - specific axis. For example, if `shape` were ``(2, 2)``, then - the parameters would be two arrays, ``[[0, 0], [1, 1]]`` and - ``[[0, 1], [0, 1]]``. `function` must be capable of operating on - arrays, and should return a scalar value. + The function is called with N parameters, where N is the rank of + `shape`. Each parameter represents the coordinates of the array + varying along a specific axis. For example, if `shape` + were ``(2, 2)``, then the parameters in turn be (0, 0), (0, 1), + (1, 0), (1, 1). shape : (N,) tuple of ints Shape of the output array, which also determines the shape of the coordinate arrays passed to `function`. @@ -1678,10 +1677,11 @@ def fromfunction(function, shape, **kwargs): Returns ------- - out : any + fromfunction : any The result of the call to `function` is passed back directly. - Therefore the type and shape of `out` is completely determined by - `function`. + Therefore the shape of `fromfunction` is completely determined by + `function`. If `function` returns a scalar value, the shape of + `fromfunction` would match the `shape` parameter. See Also -------- @@ -1689,7 +1689,7 @@ def fromfunction(function, shape, **kwargs): Notes ----- - Keywords other than `shape` and `dtype` are passed to `function`. + Keywords other than `dtype` are passed to `function`. Examples -------- @@ -1979,7 +1979,7 @@ def allclose(a, b, rtol=1.e-5, atol=1.e-8): Returns ------- - y : bool + allclose : bool Returns True if the two arrays are equal within the given tolerance; False otherwise. If either array contains NaN, then False is returned. @@ -2159,7 +2159,7 @@ def seterr(all=None, divide=None, over=None, under=None, invalid=None): See also -------- seterrcall : Set a callback function for the 'call' mode. - geterr, geterrcall + geterr, geterrcall, errstate Notes ----- |