Does the np.nan in numpy array occupy memory?

前端 未结 3 1390
忘了有多久
忘了有多久 2021-01-21 00:57

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

3条回答
  •  遥遥无期
    2021-01-21 01:35

    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.

提交回复
热议问题