Say we have a 1D numpy array of shape (4,). We initialize SparseFrame and pd.DataFrame with it. Both will have shape (4,1). Underlying numpy array of pandas data frame will also have shape (4,1), but sparsity's toarray() method will give a 1D array of shape (4,).
>>> a2 = np.array([0,1,0,0])
>>> a2.shape
(4,)
>>> pd.DataFrame(a2).shape
(4, 1)
>>> pd.DataFrame(a2).values.shape
(4, 1)
>>> sparsity.SparseFrame(a2).shape
(4, 1)
>>> sparsity.SparseFrame(a2).toarray().shape
(4,)
This leads to problems when multiplying a SparseFrame by another one-column SparseFrame.
Say we have a 1D numpy array of shape
(4,). We initialize SparseFrame and pd.DataFrame with it. Both will have shape(4,1). Underlying numpy array of pandas data frame will also have shape(4,1), but sparsity'stoarray()method will give a 1D array of shape(4,).This leads to problems when multiplying a SparseFrame by another one-column SparseFrame.