I am new to working with python datatables and here is the tutorial I am following
How do I filter out the rows where the values in a certain column are contained in a list?
Essentially this is the code I am working with:
import datatable as dt
sfr = dt.fread(os.path.join(dirName, 'Results.csv'))
sfr
Out[25]:
| ioid itemtype date itemid tid value
-------- + ---------- -------- -------- ------- ------------ -------
0 | 1 1 7-1-2022 9015 531 0.0283
1 | 1 1 7-1-2022 9015 532 0.0071
2 | 1 1 7-1-2022 9016 534 0.0065
3 | 1 1 7-1-2022 9017 1018 0.0005
I am trying to do the following
ids = [9016, 9017]
sft[dt.f.itemid.isin(ids)]
However, I am unable to make the syntax work.
Desired output is:
| ioid itemtype date itemid tid value
-------- + ---------- -------- -------- ------- ------------ -------
2 | 1 1 7-1-2022 9016 534 0.0065
3 | 1 1 7-1-2022 9017 1018 0.0005