Populate a Pandas SparseDataFrame from a SciPy Sparse Matrix

A direct conversion is not supported ATM. Contributions are welcome! Try this, should be ok on memory as the SpareSeries is much like a csc_matrix (for 1 column) and pretty space efficient In [37]: col = np.array([0,0,1,2,2,2]) In [38]: data = np.array([1,2,3,4,5,6],dtype=”float64″) In [39]: m = csc_matrix( (data,(row,col)), shape=(3,3) ) In [40]: m Out[40]: <3×3 … Read more

Scipy sparse matrices – purpose and usage of different implementations

Sorry if I’m not answering this completely enough, but hopefully I can provide some insight. CSC (Compressed Sparse Column) and CSR (Compressed Sparse Row) are more compact and efficient, but difficult to construct “from scratch”. Coo (Coordinate) and DOK (Dictionary of Keys) are easier to construct, and can then be converted to CSC or CSR … Read more