def _coo_to_sparse_series(A, dense_index=False):
 s = Series(A.data, MultiIndex.from_arrays((A.row, A.col)))
 s = s.sort_index()
 s = s.to_sparse()
 if dense_index:
  i = range(A.shape[0])
  j = range(A.shape[1])
  ind = MultiIndex.from_product([i, j])
  s = s.reindex_axis(ind)
 return s

def _coo_to_sparse_series ( A , dense_index = False ) : s = Series ( A . data , MultiIndex . from_arrays ( ( A . row , A . col ) ) ) s = s . sort_index ( ) s = s . to_sparse ( ) if dense_index : i = range ( A . shape [ 0 ] ) j = range ( A . shape [ 1 ] ) ind = MultiIndex . from_product ( [ i , j ] ) s = s . reindex_axis ( ind ) return s
convert a scipy .