Commit be7c90a6 authored by Frisinghelli Daniel's avatar Frisinghelli Daniel
Browse files

Handle negative values for array replacing.

parent 221eb041
......@@ -2523,11 +2523,11 @@ def array_replace(array, lookup):
# create an index array to replace the values in the lookup table
indices = np.arange([:, 0].max()) + 1)
indices[lookup[:, 0].astype(] = lookup[:, 1]
indices = np.arange(int(np.abs(lookup[:, 0].astype(float)).max()) + 1)
indices[lookup[:, 0].astype(int)] = lookup[:, 1]
# the array with the replaced values
return indices[array].astype(array.dtype)
return indices[array.astype(int)].astype(array.dtype)
def dec2bin(number, nbits=8):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment