AttributeError using scipy.sparse.toarray()
sfyjdyy.blogspot.com › 2018 › 09Sep 25, 2018 · 1 Answer1. sp.hstack (i.e. numpy.hstack) is the ordinary, dense hstack, which won't combine the sparse arrays correctly. It builds a 1D numpy array already (of object dtype; in other words, it just wraps the Python-level objects and crams them in there.) You want scipy.sparse.hstack: sp.hstack. numpy.hstack.