def _sparse_series_to_coo(ss, row_levels=(<NUM_LIT:0>, ), column_levels=(<NUM_LIT:1>, ),<EOL>sort_labels=False):
import scipy.sparse<EOL>if ss.index.nlevels < <NUM_LIT:2>:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if not ss.index.is_unique:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>row_levels = [ss.index._get_level_number(x) for x in row_levels]<EOL>column_levels = [ss.index._get_level_number(x) for x in column_levels]<EOL>v, i, j, rows, columns = _to_ijv(ss, row_levels=row_levels,<EOL>column_levels=column_levels,<EOL>sort_labels=sort_labels)<EOL>sparse_matrix = scipy.sparse.coo_matrix(<EOL>(v, (i, j)), shape=(len(rows), len(columns)))<EOL>return sparse_matrix, rows, columns<EOL>
Convert a SparseSeries to a scipy.sparse.coo_matrix using index
levels row_levels, column_levels as the row and column
labels respectively. Returns the sparse_matrix, row and column labels.