I have a Numpy 2-D array in which one column has Boolean values i.e. True/False. I want to convert it to integer 1 and 0 respectively, how can I do it?
E.g. my data[0::,2] is boolean, I tried
data[0::,2]=int(data[0::,2])
, but it is giving me error:
TypeError: only length-1 arrays can be converted to Python scalars
My first 5 rows of array are:
[['0', '3', 'True', '22', '1', '0', '7.25', '0'],
['1', '1', 'False', '38', '1', '0', '71.2833', '1'],
['1', '3', 'False', '26', '0', '0', '7.925', '0'],
['1', '1', 'False', '35', '1', '0', '53.1', '0'],
['0', '3', 'True', '35', '0', '0', '8.05', '0']]
dtype?