You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (27, 2) + inhomogeneous part.
#5
Shuffling Randomly and Converting into Numpy Array for Faster Processing......
ValueError Traceback (most recent call last)
Cell In[22], line 3
1 print("Shuffling Randomly and Converting into Numpy Array for Faster Processing......")
2 random.shuffle(training)
----> 3 training = np.array(training)
5 print("Creating Train and Test Lists.....")
6 train_x = list(training[:,0])
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (27, 2) + inhomogeneous part.
The text was updated successfully, but these errors were encountered:
the error occurs due to use of different datatypes in the numpy array elements, we can set the numpy array data type to object, it is a common data type that accepts all elements.
so set the datatype to object and all is fine. np.array(array, dtype=object)
Shuffling Randomly and Converting into Numpy Array for Faster Processing......
ValueError Traceback (most recent call last)
Cell In[22], line 3
1 print("Shuffling Randomly and Converting into Numpy Array for Faster Processing......")
2 random.shuffle(training)
----> 3 training = np.array(training)
5 print("Creating Train and Test Lists.....")
6 train_x = list(training[:,0])
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (27, 2) + inhomogeneous part.
The text was updated successfully, but these errors were encountered: