Write numpy arrays to lmdb
I'm trying to write some numpy arrays in python to lmdb: import numpy as np import lmdb def write_lmdb(filename): lmdb_env = lmdb.open(filename, map_size=int(1e9)) lmdb_txn = lmdb_env.begin(write=True) X= np.array([[1.0, 0.0], [0.1, 2.0]]) y= np.array([1.4, 2.1]) #Put first pair of arrays lmdb_txn.put('X', X) lmdb_txn.put('y', y) #Put second pair of arrays lmdb_txn.put('X', X+1.6) lmdb_txn.put('y', y+1.2) def read_lmdb(filename): lmdb_env = lmdb.open(filename) lmdb_txn = lmdb_env.begin() lmdb_cursor = lmdb_txn.cursor() for key, value in lmdb_cursor: print type(key) print type(value) print key