I have a numpy array where each element looks something like this:
[\'3\' \'1\' \'35\' \'0\' \'0\' \'8.05\' \'2\'] [\'3\' \'1\' \'\' \'0\' \'0\' \'8.4583\' \
Just do this first:
s = np.array(['1', '0', '']) s[s==''] = '0' s.astype(float) #array([ 1., 0., 0.])