This question was answered by the NumPy user mailing list in the section "Floats forced to string using" {: f}. Format ()? ":
It seems that np.int64 / 32 and np.str inherit their native Python __format__() , but np.float32 / 64 does not receive __builtin__.float.__format__() . This is not intuitive, but now I see why this works:
In [8]: '{:6.6s} {:8d} {:11.6f}'.format(tmp.sta, tmp.ondate, float(tmp.lat)) Out[8]: 'XYZZ 2001123 -23.820000'
Thanks!
-Jon
EDIT: np.float32 / int32 inherits from native Python types if , your system is 32-bit. The same goes for 64-bit. The mismatch will create the same problem as the original record.
source share