Pandas DataFrame.to_sparse
Pandas DataFrame.to_sparse() function convert to SparseDataFrame. The function implements the sparse version of the DataFrame meaning that any data matching a specific value it’s omitted in the representation. The sparse DataFrame allows for more efficient storage.
Syntax: DataFrame.to_sparse(fill_value=None, kind=’block’)
Parameter :
- fill_value : The specific value that should be omitted in the representation.
- kind : {‘block’, ‘integer’}, default ‘block’
Returns : SparseDataFrame
Pandas DataFrame.to_sparse() Method
Pandas DataFrame is a two-dimensional size-mutable, potentially heterogeneous tabular data structure with labeled axes (rows and columns). Arithmetic operations align on both row and column labels. It can be thought of as a dict-like container for Series objects. This is the primary data structure of the Pandas.