pandas.DataFrame.sparse.density#

DataFrame.sparse.density[source]#

Ratio of non-sparse points to total (dense) data points.

Examples

>>> df = pd.DataFrame({"A": pd.arrays.SparseArray([0, 1, 0, 1])})
>>> df.sparse.density
0.5