开发者

numpy array <=> python DB-API adapter?

开发者 https://www.devze.com 2023-01-16 15:08 出处:网络
Anyone knows is there any other adapter between numpy array and sqlite database bes开发者_如何学Goides the atpy?

Anyone knows is there any other adapter between numpy array and sqlite database bes开发者_如何学Goides the atpy?

Thanks!

Rgs,

KC


Can you use the default package, sqlite3?

In [1]: import sqlite3

In [3]: conn = sqlite3.connect('test.db')

In [4]: cur = conn.cursor()

In [5]: cur.execute('select * from table1')
Out[5]: <sqlite3.Cursor object at 0xa3142c0>

In [6]: scipy.array(cur.fetchall())
Out[6]: 
array([[ 1.,  2.],
       [ 3.,  4.]])
0

精彩评论

暂无评论...
验证码 换一张
取 消