码迷,mamicode.com
首页 > 其他好文 > 详细

numpy.tolist( )函数

时间:2020-04-04 00:21:53      阅读:664      评论:0      收藏:0      [点我收藏+]

标签:The   time   items   func   his   pos   nump   pytho   cal   

官方文档:https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.tolist.html?highlight=numpy%20tolist

 

 

numpy.ndarray.tolist
method

ndarray.tolist()
Return the array as an a.ndim-levels deep nested list of Python scalars.   nested:嵌套的

Return a copy of the array data as a (nested) Python list. Data items are converted to the nearest 
compatible builtin Python type, via the item function.
以(嵌套的)Python列表的形式返回数组数据的副本。通过item函数,将数据项转换为Python中最接近的兼容内置类型。(有道)
If a.ndim
is 0, then since the depth of the nested list is 0, it will not be a list at all, but a simple
Python scalar. Parameters: none Returns: y :
object, or list of object, or list of list of object, or … The possibly nested list of array elements. 数组元素的嵌套列表

Notes:

The array may be recreated via np.array(a.tolist()), although this may sometimes lose precision.

官网例子截图:

技术图片

 

numpy.tolist( )函数

标签:The   time   items   func   his   pos   nump   pytho   cal   

原文地址:https://www.cnblogs.com/bravesunforever/p/12629650.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!