RE: sorting items in a table problematic because of scientific notation

2009-05-04 Thread Davis, Amelie Y
] On Behalf Of Raymond Hettinger Sent: Wednesday, April 29, 2009 10:31 AM To: python-list@python.org Subject: Re: sorting items in a table problematic because of scientific notation [John Machin] 'NEAR_DIST'], [('N', 9, 0), ('N', 9, 0), ('F', 19, 11)], [53, 55, ' The data type code for the offending

Re: sorting items in a table problematic because of scientific notation

2009-04-29 Thread skip
Thanks. Didn't used to be that way I don't think. Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam float('1.23456789e+004 ') 12345.6789 John :-) Maybe string.ato[if] used to

Re: sorting items in a table problematic because of scientific notation

2009-04-29 Thread John Machin
On 29/04/2009 11:33 PM, s...@pobox.com wrote: Thanks. Didn't used to be that way I don't think. Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam float('1.23456789e+004 ') 12345.6789

Re: sorting items in a table problematic because of scientific notation

2009-04-29 Thread skip
Maybe string.ato[if] used to behave that way? John Nope. ... OK, I remember what it was. The C atof()/atoi() functions will stop at the first non-numeric character. (I believe the more modern strtod/strtof functions behave the same way.) You could thus call atof( 12345

Re: sorting items in a table problematic because of scientific notation

2009-04-29 Thread Raymond Hettinger
[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

sorting items in a table problematic because of scientific notation

2009-04-28 Thread Davis, Amelie Y
Hi All, I have a dbf table outputted by another program that I cannot (I'm pretty sure) change the format of. I use a dbf reader code found online (http://code.activestate.com/recipes/362715/ ) to read the table in and I need to sort it on a particular field but this field has scientific

Re: sorting items in a table problematic because of scientific notation

2009-04-28 Thread skip
Amélie Hi All, Amélie I have a dbf table outputted by another program that I cannot Amélie (I'm pretty sure) change the format of. Amélie I use a dbf reader code found online Amélie (http://code.activestate.com/recipes/362715/ ) to read the table Amélie in and I need to

Re: sorting items in a table problematic because of scientific notation

2009-04-28 Thread MRAB
Davis, Amelie Y wrote: Hi All, I have a dbf table outputted by another program that I cannot (I’m pretty sure) change the format of. I use a dbf reader code found online (http://code.activestate.com/recipes/362715/ ) to read the table in and I need to sort it on a particular field but this

Re: sorting items in a table problematic because of scientific notation

2009-04-28 Thread MRAB
s...@pobox.com wrote: Amélie Hi All, Amélie I have a dbf table outputted by another program that I cannot Amélie (I'm pretty sure) change the format of. Amélie I use a dbf reader code found online Amélie (http://code.activestate.com/recipes/362715/ ) to read the table

Re: sorting items in a table problematic because of scientific notation

2009-04-28 Thread skip
MRAB FYI: float(s) 105646.365517 MRAB which saves a few keystrokes. :-) Thanks. Didn't used to be that way I don't think. -- Skip Montanaro - s...@pobox.com - http://www.smontanaro.net/ XML sucks, dictionaries rock - Dave Beazley --

Re: sorting items in a table problematic because of scientific notation

2009-04-28 Thread John Machin
Davis, Amelie Y aydavis at purdue.edu writes: Hi All, I have a dbf table outputted by another program that I cannot (I’m pretty sure) change the format of. I use a dbf reader code found online (http://code.activestate.com/recipes/362715/ ) to read the table in and I need to sort it on

Re: sorting items in a table problematic because of scientific notation

2009-04-28 Thread John Machin
skip at pobox.com writes: MRAB FYI: float(s) 105646.365517 MRAB which saves a few keystrokes. Thanks. Didn't used to be that way I don't think. Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32 Copyright 1991-1995 Stichting Mathematisch