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

.loc[item, list] doesn't filter columns #73

Open
michcio1234 opened this issue Jan 16, 2019 · 0 comments
Open

.loc[item, list] doesn't filter columns #73

michcio1234 opened this issue Jan 16, 2019 · 0 comments
Labels

Comments

@michcio1234
Copy link

michcio1234 commented Jan 16, 2019

import sparsity as sp
import pandas as pd
import numpy as np

df = pd.DataFrame(np.random.rand(5,5)<0.5, columns=list('ABCDE'))
sf = sp.SparseFrame(df)

sf.loc[2, ['A', 'C', 'E']]

All columns are included in output instead of only selected ones:

     A    B    C    D    E
2  0.0  1.0  0.0  1.0  1.0
[1x5 SparseFrame of type '<class 'float64'>' 
 with 3 stored elements in Compressed Sparse Row format]

Same goes with .loc[list, item] (returns all rows instead of only selected ones):

sf.loc[[1, 2], 'A']

     A
0  0.0
1  1.0
2  1.0
3  1.0
4  1.0
[5x1 SparseFrame of type '<class 'float64'>' 
 with 4 stored elements in Compressed Sparse Row format]
@michcio1234 michcio1234 added the bug label Jul 4, 2019
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