Converting nested lists of data into multidimensional Numpy arrays

柔情痞子 提交于 2019-12-04 06:53:48

dataPoints is not a 2d list. Convert it first into a 2d list and then it will work:

d=np.array(dataPoints.tolist())

Now d is (100,3) as you wanted.

If a 2d array is what you want:

from itertools import chain
dataArray = np.array(list(chain(*data)),shape=(100,3))

I didn't work out the code so you may have to change the column/row ordering to get the shape to match.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!