Examples

In [1]:
import numpy as np
import pandas as pd
In [2]:
df = pd.DataFrame({"P": pd.SparseArray([0, 1, 0])})
df.sparse.to_dense()
Out[2]:
P
0 0
1 1
2 0