【发布时间】:2014-11-14 03:51:30
【问题描述】:
我使用下面的代码和python/pandas 在HDFStore 中存储一个包含大量NaN 值的大数据集:
with get_store(work_path+'/stores/store.h5') as store:
for chunk in reader:
for column in column_list:
store.append('%s' % column, chunk[column],
data_columns=column)
然后我想将第一列加载为numpy 数组,所以我有:
array = store.select(column_list[0]).as_matrix()
问题是我得到了一个没有任何初始 NaN 值的小数组,因为当我将数据存储在存储中时,它有点“忘记”NaN 值,只保留非 NaN值及其索引。如何取回具有初始 NaN 值的数组?
【问题讨论】:
标签: python numpy pandas nan hdfstore