get_dummies with sparse doesn't convert numeric to sparse
I got the error
<b> AttributeError: 'IntBlock' object has no attribute 'sp_index' </b>

when converting a SparseDataFrame to Scipy csr_matrix using the following code:

<i>dfTotalCat = get_dummies(dfTotalCat, sparse=True)

XTotalCat = csr_matrix(dfTotalCat.to_coo()) </i>

The SparseDataFrame is obtained from get_dummies.


Following is the exact error trace:

Traceback (most recent call last):
  File "pandaSrc.py", line 76, in <module>
    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'