Description
I got the error
AttributeError: 'IntBlock' object has no attribute 'sp_index'
when converting a SparseDataFrame to Scipy csr_matrix using the following code:
dfTotalCat = get_dummies(dfTotalCat, sparse=True)
XTotalCat = csr_matrix(dfTotalCat.to_coo())
The SparseDataFrame is obtained from get_dummies.
Following is the exact error trace:
Traceback (most recent call last):
File "pandaSrc.py", line 76, in
XTotalCat = csr_matrix(dfTotalCat.to_coo())
File "C:\Users\nagabhushan.s\AppData\Local\Programs\Python\Python36\lib\site-p
ackages\pandas\core\sparse\frame.py", line 255, in to_coo
row = s.sp_index.to_int_index().indices
File "C:\Users\nagabhushan.s\AppData\Local\Programs\Python\Python36\lib\site-p
ackages\pandas\core\generic.py", line 3614, in getattr
return object.getattribute(self, name)
File "C:\Users\nagabhushan.s\AppData\Local\Programs\Python\Python36\lib\site-p
ackages\pandas\core\sparse\series.py", line 245, in sp_index
return self.block.sp_index
AttributeError: 'IntBlock' object has no attribute 'sp_index'