I'm fairly new with numpy.
As shown below, when I try to cast the numeric values from strings to integers, it doesn't seem to 'stick', as below:
>> import numpy as np
>>> a = np.array([['a','1','2'],['b','3','4']])
>>> a[:,1:3].astype(int)
array([[1, 2],
[3, 4]])
>>> a[:,1:3] = a[:,1:3].astype(int)
>>> a
array([['a', '1', '2'],
['b', '3', '4']],
dtype='<U1')
How can I convert the string values to ints in the array ?
objectarrays but these are not what I would call recommended!). So the question you need to ask yourself is: what integer value should'a'or'b'have?