Below is a simple way to convert a dataframe column into numpya NumPy array.
df = pd.DataFrame(somedict) ytrain = df['label'] ytrain_numpy = np.array([x for x in ytrain['label']]) ytrain_numpy isytrain_numpy is a numpyNumPy array.
I tried with to.numpy(), but it gave me the below error: TypeError: no supported conversion for types: (dtype('O'),) while doing Binary Relevance classfication using Linear SVC. to
TypeError: no supported conversion for types: (dtype('O'),)* while doing Binary Relevance classfication using Linear SVC.
to.numpy() was converting the dataFrame into numpya NumPy array, but the inner element's data type was a list because of which the above error was observed.