Skip to content

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

@michcio1234

Description

@michcio1234

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions