解决多维数组合并报错:VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences

原报错提示为:

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
  return array(a, dtype, copy=False, order=order)

这是由于数组维度不一样导致的,不能直接简单附加在后面
解决方案:使用extend函数进行合并
false:sum.append(q)
修改后:sum.extend(q)

你可能感兴趣的:(笔记,python)