Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Respect fill_value argument in COO constructor #179
It's not clear from the documentation what's the use of the fill_value argument in the COO constructor. But I guess I can use it to tell sparse that I am using some value other than 0 for the majority of data. But it seems if I pass it when creating a COO array, it doesn't have any effect.
For example in the below code I am using np.nan instead of 0 as the fill value but sparse.COO creates an array with nnz=100 and fill_value=0.0, which isn't really sparse.
In : import numpy as np In : import sparse In : arr1 = np.random.random(100) In : arr1[arr1 < 0.9] = np.nan In : c1 = sparse.COO(arr1, fill_value=np.nan) In : c1 Out: <COO: shape=(100,), dtype=float64, nnz=100, fill_value=0.0>