我有一个庞大的csv文件,无法将其加载到内存中.将其转换为libsvm格式可以节省一些内存. CSV文件中有很多Nan.如果我读取行并将它们存储为np.array,而np.nan为NULL,该数组是否仍会占用过多内存? 数组中的np.nan是否还会占用内存吗?
I have a huge file of csv which can not be loaded into memory. Transforming it to libsvm format may save some memory. There are many nan in csv file. If I read lines and store them as np.array, with np.nan as NULL, will the array still occupy too much memory ? Does the np.nan in array also occupy memory ?
推荐答案使用NaN和inf)也由特定的二进制模式表示,该模式占用与任何数字浮点值相同的位数.因此,NaN占用的内存量与数组中的任何其他数字相同.
When working with floating point representations of numbers, non-numeric values (NaN and inf) are also represented by a specific binary pattern occupying the same number of bits as any numeric floating point value. Therefore, NaNs occupy the same amount of memory as any other number in the array.
更多推荐
numpy数组中的np.nan是否占用内存?
发布评论