def _to_ijv(ss, row_levels=(<NUM_LIT:0>, ), column_levels=(<NUM_LIT:1>, ), sort_labels=False):
<EOL>_check_is_partition([row_levels, column_levels], range(ss.index.nlevels))<EOL>values = ss._data.internal_values()._valid_sp_values<EOL>nonnull_labels = ss.dropna()<EOL>def get_indexers(levels):<EOL><INDENT>"""<STR_LIT>"""<EOL>values_ilabels = [tuple(x[i] for i in levels)<EOL>for x in nonnull_labels.index]<EOL>if len(levels) == <NUM_LIT:1>:<EOL><INDENT>values_ilabels = [x[<NUM_LIT:0>] for x in values_ilabels]<EOL><DEDENT>def _get_label_to_i_dict(labels, sort_labels=False):<EOL><INDENT>"""<STR_LIT>"""<EOL>labels = Index(lmap(tuple, labels)).unique().tolist()  <EOL>if sort_labels:<EOL><INDENT>labels = sorted(list(labels))<EOL><DEDENT>d = OrderedDict((k, i) for i, k in enumerate(labels))<EOL>return (d)<EOL><DEDENT>def _get_index_subset_to_coord_dict(index, subset, sort_labels=False):<EOL><INDENT>ilabels = list(zip(*[index._get_level_values(i) for i in subset]))<EOL>labels_to_i = _get_label_to_i_dict(ilabels,<EOL>sort_labels=sort_labels)<EOL>labels_to_i = Series(labels_to_i)<EOL>if len(subset) > <NUM_LIT:1>:<EOL><INDENT>labels_to_i.index = MultiIndex.from_tuples(labels_to_i.index)<EOL>labels_to_i.index.names = [index.names[i] for i in subset]<EOL><DEDENT>else:<EOL><INDENT>labels_to_i.index = Index(x[<NUM_LIT:0>] for x in labels_to_i.index)<EOL>labels_to_i.index.name = index.names[subset[<NUM_LIT:0>]]<EOL><DEDENT>labels_to_i.name = '<STR_LIT:value>'<EOL>return (labels_to_i)<EOL><DEDENT>labels_to_i = _get_index_subset_to_coord_dict(ss.index, levels,<EOL>sort_labels=sort_labels)<EOL>i_coord = labels_to_i[values_ilabels].tolist()<EOL>i_labels = labels_to_i.index.tolist()<EOL>return i_coord, i_labels<EOL><DEDENT>i_coord, i_labels = get_indexers(row_levels)<EOL>j_coord, j_labels = get_indexers(column_levels)<EOL>return values, i_coord, j_coord, i_labels, j_labels<EOL>
For arbitrary (MultiIndexed) SparseSeries return
    (v, i, j, ilabels, jlabels) where (v, (i, j)) is suitable for
    passing to scipy.sparse.coo constructor.