I have numpy array like this:
myarray = array(['31,67,82', '31,72,82', '31,41,77'])
I want to split the text by using comma as separator. Then I want them to be converted into an integer.
I tried,
a = list()
for x in myarray:
a.append(np.char.split(x, sep =','))
It is working but when I want it to convert into integer by using astype(np.int)
like,
a = list()
for x in myarray:
a.append(np.char.split(x, sep =',').astype(np.int)
I faced the following error:
ValueError: setting an array element with a sequence.
How can I achieve that?
Thanks in advance!
My desired output is something like:
np.array([[31,67,82] , [31,72,82],[31,41,77]])