'Trying to load data for ml project in jupyter notebook but having issues with dtype

enter image description here

I'm trying to load images into my jupyter notebook but I'm getting this error

TypeError                                 Traceback (most recent call last)
TypeError: only size-1 arrays can be converted to Python scalars

The above exception was the direct cause of the following exception:

ValueError                                Traceback (most recent call last)
<ipython-input-47-2c9ffeecfd71> in <module>
----> 1 (train_images,train_labels),(test_images,test_labels)=load_data()

<ipython-input-46-35eab29fae5f> in load_data()
     29                 labels.append(label)
     30 
---> 31             images=np.array(images,dtype='float32')
     32             labels=np.array(labelsdtype='int32')
     33 

ValueError: setting an array element with a sequence.


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source