Converting list to numpy array

后端 未结 1 990
谎友^
谎友^ 2020-12-24 04:50

I have managed to load images in a folder using the command line sklearn: load_sample_images()

I would now like to convert it to a numpy.ndarray

相关标签:
1条回答
  • 2020-12-24 05:40

    If you have a list of lists, you only needed to use ...

    import numpy as np
    ...
    npa = np.asarray(someListOfLists, dtype=np.float32)
    

    per this LINK in the scipy / numpy documentation. You just needed to define dtype inside the call to asarray.

    0 讨论(0)
提交回复
热议问题