I am using np,argmax to extract the position of the largest element in an array. I need to be able to convert this position - e.g. [x] into a string "[x]" so that I can write this to a text file.
However it either doesn't write anything to the file, throws a "TypeError: write() argument must be str, not numpy.ndarray" or throws "write() argument must be str, not bytes" error.
largest_elem_pos = np.argmax(array, axis=-1)
f = open("output.txt", "w")
f.write(largest_elem_pos)
Everything I've tried so far doesn't seem to work. I'm probably being an idiot here, any help would be appreciated!
Thanks in advance