I have the dataset
dataset=Dataset[{
<|"x" -> 320, "y" -> 178, "z" -> 291|>,
<|"x" -> 360, "y" -> 114, "z" -> 109|>,
<|"x" -> 400, "y" -> 186, "z" -> 265|>,
<|"x" -> 440, "y" -> 419, "z" -> 469|>,
<|"x" -> 480, "y" -> 228, "z" -> 251|>,
<|"x" -> 520, "y" -> 153, "z" -> 129|>,
<|"x" -> 560, "y" -> 284, "z" -> 177|>,
<|"x" -> 600, "y" -> 246, "z" -> 323|>,
<|"x" -> 640, "y" -> 333, "z" -> 108|>,
<|"x" -> 680, "y" -> 383, "z" -> 261|>
}]
I want to change the "z"
values to 0 if the corresponding "x" value is smaller than 380
OR larger than 620
.
If this dataset is a list, I can do
data = dataset // Values // Normal
Map[
If[#[[1]] < 380 || #[[1]] > 620, {#[[1]], #[[2]], 0}, #] &
, data
]
% // TableForm
But I need some help achieving it when the numbers are inside a dataset.