sorting items in a table problematic because of scientific notation

Raymond Hettinger python at rcn.com
Wed Apr 29 10:31:04 EDT 2009


[John Machin]
> > 'NEAR_DIST'], [('N', 9, 0), ('N', 9, 0), ('F', 19, 11)], [53, 55, '
>
> The data type code for the offending column is "F" which is not in the
> bog-standard dBase III set of C, N, D, and L. The code that you have used merely
> returns unchanged the character string that finds in the data base.
>
>
>
> > 1.05646365517e+005'], [53, 6, ' 9.32599134016e+004'], [53, 0, '
> > 8.97477154418e+004'], [53, 2, ' 8.96449127749e+004'], [53, 1, '
> > 7.88170078501e+004'], [53, 5, ' 8.29281503631e+004'], [53, 4, '

FWIW, I just updated the recipe to handle an F typecode
by casting it to a float.  Hope this helps.


Raymond



More information about the Python-list mailing list