diff options
Diffstat (limited to 'numpy/add_newdocs.py')
-rw-r--r-- | numpy/add_newdocs.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py index 17d21cd7c..3529938a5 100644 --- a/numpy/add_newdocs.py +++ b/numpy/add_newdocs.py @@ -2198,14 +2198,27 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('var', add_newdoc('numpy.core.multiarray', 'ndarray', ('view', - """a.view(dtype=None) + """a.view(dtype=None, type=None) New view of array with the same data. Parameters ---------- - dtype : sub-type or data-descriptor - Data-type of the returned view. + dtype : data-type + Data-type descriptor of the returned view, e.g. float32 or int16. + type : python type + Type of the returned view, e.g. ndarray or matrix. + + Examples + -------- + >>> x = np.array([(1,2)],dtype=[('a',np.int8),('b',np.int8)]) + >>> y = x.view(dtype=np.int16, type=np.matrix) + + >>> print y.dtype + int16 + + >>> print type(y) + <class 'numpy.core.defmatrix.matrix'> """)) |