I have created a datatable as,
DT_X = dt.Frame({'x':[1,2,3,4,5],
'y':[0.1,0.5,0.9,1.5,4.3],
'z':['a','b','c','d','e'],
'u':[True,False,True,False,False],
'v':[10,20,30,40,50],
'r':[4.5,5.5,6.5,8.5,10.5]
})
and its output as
Out[4]:
| x y z u v r
-- + -- --- -- -- -- ----
0 | 1 0.1 a 1 10 4.5
1 | 2 0.5 b 0 20 5.5
2 | 3 0.9 c 1 30 6.5
3 | 4 1.5 d 0 40 8.5
4 | 5 4.3 e 0 50 10.5
[5 rows x 6 columns]
The datatable types can be checked as,
In [5]: DT_X.stypes
Out[5]:
(stype.int32,
stype.float64,
stype.str32,
stype.bool8,
stype.int32,
stype.float64)
I can now select integer and bool type columns as
DT_X[:,[dt.int32,dt.bool8]]
Out[6]:
| x v u
-- + -- -- --
0 | 1 10 1
1 | 2 20 0
2 | 3 30 1
3 | 4 40 0
4 | 5 50 0
[5 rows x 3 columns]
As recommended the columns can be deselected with this code,
DT_X[:,f[:].remove([f.x,f.v,f.u])]
Out[7]:
| y z r
-- + --- -- ----
0 | 0.1 a 4.5
1 | 0.5 b 5.5
2 | 0.9 c 6.5
3 | 1.5 d 8.5
4 | 4.3 e 10.5
[5 rows x 3 columns]
So, How to deselect only integer and bool type columns ?. the below code chunks is not worked out
DT_X[:,f[:].remove([dt.int32,dt.bool8])]