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