riptable
riptable copied to clipboard
accum_cols with a categorical that has sort_display=True gives results in wrong order
import riptable as rt
import numpy as np
n = 10_000
ds = rt.Dataset({
'a': rt.Cat((rt.arange(n)%5==0).astype(np.int8)),
'b': rt.Cat(((rt.arange(n)//5)%5==0).astype(np.int8)),
'x': rt.arange(n)%3
})
print(rt.accum_cols(rt.Cat([ds['a'], ds['b']], sort_display=True), val_list=[ds['x']], func_list='nansum'))
print(ds['x'][(ds['a'] == 1)&(ds['b'] == 1)].nansum())
*a *b col0
-- ----- ----
0 0 399
. 1 1600
1 0 1601
. 1 6399
-- ----- ----
Total 9999
399