Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
SparseDataFrame to_csv returns IndexError: too many indices for array #19384
Calling to_csv on a SparseDataFrame returns IndexError: too many indices for array.
import pandas as pd from scipy.sparse import rand x = rand(100, 10001, density=0.2, format='csr') df = pd.SparseDataFrame(x) df.to_csv("tmp.csv")
Calling .to_dense() on the df prior to writing out, of course, works fine.
I'd like to be able to save sparse data to disk. If for some reason it shouldn't be written out this way, is there any way to add that in the doc or the error message?
Nontype, no exception, and a csv on the file system.