diff options
author | Travis Oliphant <teoliphant@gmail.com> | 2018-10-31 16:59:58 -0500 |
---|---|---|
committer | Travis Oliphant <teoliphant@gmail.com> | 2018-10-31 16:59:58 -0500 |
commit | 3da7c73103d653a6e431924f6f4084224b8bb73b (patch) | |
tree | 54d468b1dcae9ee12f8db35d952a5467d661342a /numpy/core/numeric.py | |
parent | 95998ca8241977be4fc2e424da33596c4227dab3 (diff) | |
download | numpy-3da7c73103d653a6e431924f6f4084224b8bb73b.tar.gz |
DOC: Clarify that 0d arrays are dimension-lifted to 1d in asfortranarray and ascontiguousarray
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r-- | numpy/core/numeric.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 5d82bbd8d..bfe72ceb6 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -587,7 +587,7 @@ def asanyarray(a, dtype=None, order=None): def ascontiguousarray(a, dtype=None): """ - Return a contiguous array in memory (C order). + Return a contiguous array (ndim >= 1) in memory (C order). Parameters ---------- @@ -618,13 +618,16 @@ def ascontiguousarray(a, dtype=None): >>> x.flags['C_CONTIGUOUS'] True + Note: This function returns an array with at least one-dimension (1-d) + so it will not preserve 0-d arrays. + """ return array(a, dtype, copy=False, order='C', ndmin=1) def asfortranarray(a, dtype=None): """ - Return an array laid out in Fortran order in memory. + Return an array (ndim >= 1) laid out in Fortran order in memory. Parameters ---------- @@ -655,6 +658,9 @@ def asfortranarray(a, dtype=None): >>> y.flags['F_CONTIGUOUS'] True + Note: This function returns an array with at least one-dimension (1-d) + so it will not preserve 0-d arrays. + """ return array(a, dtype, copy=False, order='F', ndmin=1) |