I have a dataset built from a call to SemanticImport("/data.csv", Delimiters -> ",") with data.csv of the form:
Src, Dst, Size, Arrival, Delay, SrcClk, TrgClk, Nhops, Route, SrcErr, TrgErr
12, 22, 100, 1199145666.72, 10.483, 2107, 107, 12, 7774334, 0.002, 0.048
12, 22, 100, 1199145696.88, 10.42, ffff, 107, 12, 7774334, 0.002, 0.048
....
I would like to erase rows whose column called "SrcClk" has some bad values (ie, values different than "2107"). I've tried doing this with DeleteCases
such as :
DeleteCases[d, "SrcClk" != 2107]
with no success. DeleteCases
expects a list, not a dataset so I guess it's the problem but I don't know how. While looking for an answer, I found many answers added a "&" at the end of their query but I don't know why.
DeleteCases
expects a pattern, but you do provide (half of) a function (the other half is the missing&
). You probably really should look into the documentation forDeleteCases
,Select
andFunction
to understand why and when a&
is mandatory. On the other hand to delete from aDataset
you'd typically use the newQuery
syntax specifically made for them:d[Select[(#SrcClk=!=2107)&]]
, which you'll find in the documentation forDataset
... $\endgroup$