I need a simple interface class "Data" that handles the BerkeleyDB connections for table data with id's as columns and dates as rows such as
,A,B
20080101,3,10
20080102,2,20
20080103,1,30
20080104,0,40
This simple "Data" class will have the following 5 methods:
* __init__(self, filename): opens a BerkeleyDB database connection to "filename"
* get(self, ids, d1, d2): returns a scipy array of floats (ie, a matrix) for each id in the "ids" list for dates between "d1" and "d2"
* update(self, ids, date_vec, matrix): takes a list of "ids" and "date_vec" and a scipy array "matrix" and updates the BerkeleyDB
* load_csv(self, filename): reads a csv table (see above) and updates the BerkeleyDB
* dump_csv(self, filename): writes the BerkeleyDB to csv table (see above)
The class will use both the python module "bsddb" for the "Interface to Berkeley DB library" and the python module "csv" for reading/writing the csv files.
As stated above, I would prefer that the matrix data be return as a Scipy array, but a nested list of floats would be acceptable.
I would anticipate this project to take approximately 1 hour for someone with experience with python, BerkeleyDB, and bsddb.
Please don't hesitate to PM me for any clarifications required.
Best,
J