How would I be able to turn all float numpy arrays into strings arrays?
import numpy as np
floats = np.array([1,3.4,0.678,11.1])
Expected output:
np.array(['1','3.4','0.678','11.1'])
CodePudding user response:
The simplest way:
np.array([1,3.4,0.678,11.1]).astype(str)
output:
array(['1.0', '3.4', '0.678', '11.1'], dtype='<U32')
CodePudding user response:
strings = [str(value) for value in floats]