SparseSeries.to_coo()

pandas.SparseSeries.to_coo

SparseSeries.to_coo(row_levels=(0, ), column_levels=(1, ), sort_labels=False)

Create a scipy.sparse.coo_matrix from a SparseSeries with MultiIndex.

Use row_levels and column_levels to determine the row and column coordinates respectively. row_levels and column_levels are the names (labels) or numbers of the levels. {row_levels, column_levels} must be a partition of the MultiIndex level names (or numbers).

New in version 0.16.0.

Parameters:

row_levels : tuple/list

column_levels : tuple/list

登录查看完整内容