MCPcopy Index your code
hub / github.com/numpy/numpy / tolist

Method tolist

numpy/matrixlib/defmatrix.py:270–290  ·  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

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