Skip to content
Snippets Groups Projects
Commit 13d2f989 authored by Frisinghelli Daniel's avatar Frisinghelli Daniel
Browse files

Improved the function to replace array values such that it handles also string datatypes.

parent 5dacadea
No related branches found
No related tags found
No related merge requests found
...@@ -2217,8 +2217,8 @@ def array_replace(array, lookup): ...@@ -2217,8 +2217,8 @@ def array_replace(array, lookup):
""" """
# create an index array to replace the values in the lookup table # create an index array to replace the values in the lookup table
indices = np.arange(lookup[:, 0].max() + 1) indices = np.arange(np.int(lookup[:, 0].max()) + 1).astype(object)
indices[lookup[:, 0]] = lookup[:, 1] indices[lookup[:, 0].astype(np.int)] = lookup[:, 1]
# the array with the replaced values # the array with the replaced values
return indices[array] return indices[array]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment