Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When initializing from 1D array, behaviour is inconsistent with Pandas #55

Open
michcio1234 opened this issue Sep 4, 2018 · 1 comment

Comments

@michcio1234
Copy link

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.

@michcio1234
Copy link
Author

Although the inconsistency exists, I can't reproduce errors in multiplication. Maybe I was wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant