sta*_*tti 8 python performance dbf xbase python-3.x
我有一个大的DBF文件(~700MB).我想使用python脚本从中选择几行.我已经看到dbfpy是一个很好的模块,允许打开这种类型的数据库,但是现在我还没有找到任何查询功能.迭代python中的所有元素实在太慢了.
我可以在合理的时间内从python做我想做的事吗?
Eth*_*man 13
使用我的dbf模块,您可以创建临时索引,然后使用以下内容进行搜索:
import dbf
table = dbf.Table('big.dbf')
index = table.create_index(lambda rec: rec.field) # field should be actual field name
records = index.search(match=('value',))
Run Code Online (Sandbox Code Playgroud)
创建索引可能需要几秒钟,但之后的搜索非常快.
归档时间: |
|
查看次数: |
4190 次 |
最近记录: |