我有关于HDF5性能和并发性的以下问题:
参考文献:
我有成千上万的长整数列表(8640).例如:
type(l1)
tuple
len(l1)
2
l1[0][:10]
[0, 31, 23, 0, 0, 0, 0, 0, 0, 0]
l1[1][:10]
[0, 0, 11, 16, 24, 0, 0, 0, 0, 0]
Run Code Online (Sandbox Code Playgroud)
我正在"挑选"元组,似乎当元组是列表时,pickle文件比numpy数组更轻.我不是python的新手,但绝不是我是专家,我真的不知道如何为不同类型的对象管理内存.我希望numpy数组更轻,但这是我在挑选不同类型的对象时获得的:
#elements in the tuple as a numpy array
l2 = [np.asarray(l1[i]) for i in range(len(l1))]
l2
[array([ 0, 31, 23, ..., 2, 0, 0]), array([ 0, 0, 11, ..., 1, 0, 0])]
#integers in the array are small enough to be saved in two bytes
l3 = [np.asarray(l1[i], dtype='u2') for i in …Run Code Online (Sandbox Code Playgroud)