[Numpy-discussion] asarray(sparse) -> object

josef.pktd at gmail.com josef.pktd at gmail.com
Fri Nov 20 15:40:16 EST 2015


Is this intentional?


>>> exog
<50x5 sparse matrix of type '<class 'numpy.float64'>'
with 50 stored elements in Compressed Sparse Column format>

>>> np.asarray(exog)
array(<50x5 sparse matrix of type '<class 'numpy.float64'>'
with 50 stored elements in Compressed Sparse Column format>, dtype=object)


I'm just a newbie who thought to use the usual pattern.


....

>>> np.asarray(exog).dot(beta)
array([ <50x5 sparse matrix of type '<class 'numpy.float64'>'
with 50 stored elements in Compressed Sparse Column format>,
       <50x5 sparse matrix of type '<class 'numpy.float64'>'
with 50 stored elements in Compressed Sparse Column format>,
       <50x5 sparse matrix of type '<class 'numpy.float64'>'
with 50 stored elements in Compressed Sparse Column format>,
       <50x5 sparse matrix of type '<class 'numpy.float64'>'
with 50 stored elements in Compressed Sparse Column format>,
       <50x5 sparse matrix of type '<class 'numpy.float64'>'
with 50 stored elements in Compressed Sparse Column format>], dtype=object)
C:\programs\WinPython-64bit-3.4.3.1\python-3.4.3.amd64\lib\site-packages\scipy\sparse\compressed.py:306:
SparseEfficiencyWarning: Comparing sparse matrices using >= and <= is
inefficient, using <, >, or !=, instead.
  "using <, >, or !=, instead.", SparseEfficiencyWarning)

seems to warn only once

>>> y = np.asarray(exog).dot(beta)
>>> y.shape
(5,)


>>> np.__version__
'1.9.2rc1'

>>> scipy.__version__
'0.15.1'



Josef
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20151120/2fe79313/attachment.html>


More information about the NumPy-Discussion mailing list