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

Indexing columns fail if columns are not unique #1

Open
kayibal opened this issue Apr 12, 2017 · 0 comments
Open

Indexing columns fail if columns are not unique #1

kayibal opened this issue Apr 12, 2017 · 0 comments
Assignees
Labels

Comments

@kayibal
Copy link
Owner

kayibal commented Apr 12, 2017

pd.Index.get_loc returns a Mask if the Index is not unique

import sparsity as sp
import numpy as np
sf = sp.SparseFrame(np.zeros((5,3)), columns=['A', 'A', 'B'])
sf['B'].toarray()
array([ 0.,  0.,  0.,  0.,  0.])
sf['A'].toarray()
Traceback (most recent call last):
  File "/Users/kayibal/virtualenvs/traildb-sparse/lib/python3.5/site-packages/scipy/sparse/csr.py", line 244, in asindices
    x = x.astype(idx_dtype)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'slice'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/Users/kayibal/Code/traildb_to_sparse/traildb_to_sparse/traildb_to_sparse/sparsity/sparse_frame.py", line 455, in __getitem__
    return SparseFrame(self.data[:,idx], index=self.index,
  File "/Users/kayibal/virtualenvs/traildb-sparse/lib/python3.5/site-packages/scipy/sparse/csr.py", line 336, in __getitem__
    col = asindices(col)
  File "/Users/kayibal/virtualenvs/traildb-sparse/lib/python3.5/site-packages/scipy/sparse/csr.py", line 246, in asindices
    raise IndexError('invalid index')
IndexError: invalid index
@kayibal kayibal added the bug label Apr 12, 2017
@kayibal kayibal self-assigned this Apr 12, 2017
kayibal pushed a commit that referenced this issue Apr 14, 2017
Added docstrings, some code beautifications and fixed head method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant