I have few numpy arrays, which can be formatted as
[1.525, 2.565, 6.367, ...] # elements are float numbers
or
['', '', '', ...] # elements are empty strings
I'd like to find out if all the elements in an array are of the same data type.
For now, I am using:
if isinstance(np.any(time_serie),float):
return sum(time_serie)
But this one doesn't work. I got following error:
TypeError: cannot perform reduce with flexible type
So, may I know how to work around this? Thanks.
dtypeof the array. If it isn'tobject, then they're all the same type. If it isobject, then you've got more work to do...