I'm working on a script that converts ids of school names to actual school names structured in a numpy array.
For example
[[1,2,3],[3,6,7]]
becomes
[[school-a,school-b,school-c],[school-c,school-f,school-g]
The school and ids sit together in a python dictionary.
I've tried doing this:
for x in np.nditer(finalarray, op_flags=['readwrite']):
x[...] = school_ids.get(int(x))
print(school_ids.get(int(x)))
print(finalarray)
but that gave the error:
ValueError: invalid literal for int() with base 10: 'school-a'
it's important that the structure of the numpy array stays the same, because I also thought of just iterating every item, but then the structure is lost.