Skip to main content
added 18 characters in body
Source Link

If you want to use DeleteCases, then the following works. I have borrowed the prior formulation to set up the dataset, and use @m_goldberg "keys" and "ds" variables. Thank you.

delL = ReplacePart[ConstantArray[_, Length[keys]], 6 -> s_ /; ToString[s] != "2107"]
delA = AssociationThread[keys -> delL]
DeleteCases[ds, delA]

A couple of comments: first the temporary variables are here to make it clearer. Not pretty but show the intermediate results. Second the magic number 6 for the ReplacePart could be done by indexing into the keys list, but it just makes things bushier.

Finally, the FullForm of ds shows that the type of SrcClk is AnyType, because of havingthe data for the column has both the number 2107 and the string ffff. The ToString in the Conditional forces this conversion.

If you want to use DeleteCases, then the following works. I have borrowed the prior formulation to set up the dataset, and use @m_goldberg "keys" and "ds" variables. Thank you.

delL = ReplacePart[ConstantArray[_, Length[keys]], 6 -> s_ /; ToString[s] != "2107"]
delA = AssociationThread[keys -> delL]
DeleteCases[ds, delA]

A couple of comments: first the temporary variables are here to make it clearer. Not pretty but show the intermediate results. Second the magic number 6 for the ReplacePart could be done by indexing into the keys list, but it just makes things bushier.

Finally, the FullForm of ds shows that the type of SrcClk is AnyType, because of having both the number 2107 and the string ffff. The ToString in the Conditional forces this conversion.

If you want to use DeleteCases, then the following works. I have borrowed the prior formulation to set up the dataset, and use @m_goldberg "keys" and "ds" variables. Thank you.

delL = ReplacePart[ConstantArray[_, Length[keys]], 6 -> s_ /; ToString[s] != "2107"]
delA = AssociationThread[keys -> delL]
DeleteCases[ds, delA]

A couple of comments: first the temporary variables are here to make it clearer. Not pretty but show the intermediate results. Second the magic number 6 for the ReplacePart could be done by indexing into the keys list, but it just makes things bushier.

Finally, the FullForm of ds shows that the type of SrcClk is AnyType, because the data for the column has both the number 2107 and the string ffff. The ToString in the Conditional forces this conversion.

Source Link

If you want to use DeleteCases, then the following works. I have borrowed the prior formulation to set up the dataset, and use @m_goldberg "keys" and "ds" variables. Thank you.

delL = ReplacePart[ConstantArray[_, Length[keys]], 6 -> s_ /; ToString[s] != "2107"]
delA = AssociationThread[keys -> delL]
DeleteCases[ds, delA]

A couple of comments: first the temporary variables are here to make it clearer. Not pretty but show the intermediate results. Second the magic number 6 for the ReplacePart could be done by indexing into the keys list, but it just makes things bushier.

Finally, the FullForm of ds shows that the type of SrcClk is AnyType, because of having both the number 2107 and the string ffff. The ToString in the Conditional forces this conversion.