MCPcopy Create free account
hub / github.com/numpy/numpy / tolist

Method tolist

numpy/matrixlib/defmatrix.py:265–285  ·  view source on GitHub ↗

Return the matrix as a (possibly nested) list. See `ndarray.tolist` for full documentation. See Also -------- ndarray.tolist Examples -------- >>> x = np.matrix(np.arange(12).reshape((3,4))); x matrix([[ 0, 1, 2, 3],

(self)

Source from the content-addressed store, hash-verified

263 # Necessary because base-class tolist expects dimension
264 # reduction by x[0]
265 def tolist(self):
266 """
267 Return the matrix as a (possibly nested) list.
268
269 See `ndarray.tolist` for full documentation.
270
271 See Also
272 --------
273 ndarray.tolist
274
275 Examples
276 --------
277 >>> x = np.matrix(np.arange(12).reshape((3,4))); x
278 matrix([[ 0, 1, 2, 3],
279 [ 4, 5, 6, 7],
280 [ 8, 9, 10, 11]])
281 >>> x.tolist()
282 [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]]
283
284 """
285 return self.__array__().tolist()
286
287 # To preserve orientation of result...
288 def sum(self, axis=None, dtype=None, out=None):

Callers 1

test_array_to_listMethod · 0.45

Calls 1

__array__Method · 0.45

Tested by 1

test_array_to_listMethod · 0.36