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]
All columns are included in output instead of only selected ones:
Same goes with
.loc[list, item](returns all rows instead of only selected ones):