I have a numpy array with some floats and some nans:
a = [ 8.08970226 nan nan 8.30043545 nan nan nan nan]
I want to convert it to an array (for printing in Latex) to the mixed form:
a = ['8.08970226', '--', '--', '8.30043545', '--', '--', '--', '--']
The method I've worked out, which is not elegant, is:
a=a.astype('|S10')
a[a=='nan']='--'
a=list(a)
Is there a more elegant way to do the job? (I could probably stop at the second line for my Latex requirement.)
Advice apreciated