Re: [Numpy-discussion] query to array

2007-01-31 Thread Tom Denniston
Ok, I don't have the pyodbc so I can't test this example but it would look something like this assuming the date was a 10 char string (numpy doesn't support mx.DateTimes natively, much to my chagrin) and the Close was a float: > import pyodbc > import numpy as np > > connection = pyodbc.connect('D

Re: [Numpy-discussion] query to array

2007-01-31 Thread Keith Goodman
On 1/31/07, Tom Denniston <[EMAIL PROTECTED]> wrote: > i would do something like the following. I don't have your odbc > library so I mocked it up with a fake iterator called "it". This > example would be for a two column result where the first is an int and > the second a string. Note it create

Re: [Numpy-discussion] query to array

2007-01-31 Thread Tom Denniston
i would do something like the following. I don't have your odbc library so I mocked it up with a fake iterator called "it". This example would be for a two column result where the first is an int and the second a string. Note it creates a recarray which you can have match you database column nam

Re: [Numpy-discussion] query to array

2007-01-31 Thread Keith Goodman
On 1/31/07, BBands <[EMAIL PROTECTED]> wrote: > import pyodbc > import numpy as np > > connection = pyodbc.connect('DSN=DSNname') > cursor = connection.cursor() > symbol = 'ibm' > request = "select to_days(Date), Close from price where symbol = '" + > symbol + "' and date > '2006-01-01'" > for row

[Numpy-discussion] query to array

2007-01-31 Thread BBands
Good afternoon, The following works: import pyodbc import numpy as np connection = pyodbc.connect('DSN=DSNname') cursor = connection.cursor() symbol = 'ibm' request = "select to_days(Date), Close from price where symbol = '" + symbol + "' and date > '2006-01-01'" for row in cursor.execute(reques