diff options
author | Sebastian Berg <sebastianb@nvidia.com> | 2023-03-07 20:16:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-07 20:16:46 +0100 |
commit | b6d372c25fab5033b828dd9de551eb0b7fa55800 (patch) | |
tree | a35621fe4b249b0938d7d55f7b8385c4c9c294b8 /numpy/lib | |
parent | e82af22dd1d7c01329b640f1fb6cdee6b1169898 (diff) | |
parent | 3b57b3294e594d3635fecc13a0923994e8ab36fc (diff) | |
download | numpy-b6d372c25fab5033b828dd9de551eb0b7fa55800.tar.gz |
Merge pull request #23355 from WarrenWeckesser/doc-info
DOC: Document that info() handles array instances.
Diffstat (limited to 'numpy/lib')
-rw-r--r-- | numpy/lib/utils.py | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py index 8d2d2fe33..b5add0ace 100644 --- a/numpy/lib/utils.py +++ b/numpy/lib/utils.py @@ -528,15 +528,16 @@ def _info(obj, output=None): @set_module('numpy') def info(object=None, maxwidth=76, output=None, toplevel='numpy'): """ - Get help information for a function, class, or module. + Get help information for an array, function, class, or module. Parameters ---------- object : object or str, optional - Input object or name to get information about. If `object` is a - numpy object, its docstring is given. If it is a string, available - modules are searched for matching objects. If None, information - about `info` itself is returned. + Input object or name to get information about. If `object` is + an `ndarray` instance, information about the array is printed. + If `object` is a numpy object, its docstring is given. If it is + a string, available modules are searched for matching objects. + If None, information about `info` itself is returned. maxwidth : int, optional Printing width. output : file like object, optional @@ -575,6 +576,22 @@ def info(object=None, maxwidth=76, output=None, toplevel='numpy'): *** Repeat reference found in numpy.fft.fftpack *** *** Total of 3 references found. *** + When the argument is an array, information about the array is printed. + + >>> a = np.array([[1 + 2j, 3, -4], [-5j, 6, 0]], dtype=np.complex64) + >>> np.info(a) + class: ndarray + shape: (2, 3) + strides: (24, 8) + itemsize: 8 + aligned: True + contiguous: True + fortran: False + data pointer: 0x562b6e0d2860 + byteorder: little + byteswap: False + type: complex64 + """ global _namedict, _dictlist # Local import to speed up numpy's import time. |