python报错
VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated.
If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
a=np.array(newlist)#,dtype=object
这个错误提示的很明显了,加上dtype=object,其实加不加没啥影响,就是警告烦人
a=np.array(newlist,dtype=object)
本文针对Python中创建不规则嵌套序列数组时出现的VisibleDeprecationWarning警告进行了解释,并提供了解决方案:通过指定'dtype=object'来避免此类警告。
2万+

被折叠的 条评论
为什么被折叠?



