I have the following dataset:
data = {<|"col1" -> 1, "col2" -> 0.249|>, <|"col1" -> 3,
"col2" -> 0.406|>, <|"col1" -> 5, "col2" -> 0.018|>};
ds = Dataset[data]
I now want to add a third column, which its values are based on this interpolation:
interpolation = Interpolation[{
{2, 13},
{3, -4},
{4, 7},
{5, 11}
}]
As suggested in this answer, I tried to do
ds[All, <|#, "col3" -> interpolation[#col1]|> &]
but nothing is evaluated; I get the warning
Input value {1} lies outside the range of data in the interpolating function. Extrapolation will be used.
Indeed, WL needs to extrapolate to get the value of interpolation[1], but when evaluated as a single instruction, a numerical values is returned:
interpolation[1] // N
(*93*)
Any idea how I can force the evaluation and get a dataset with "col3"?


ds[All, <|#, "col3" -> Quiet @ interpolation[#col1]|> &]if you just want to suppress the message. $\endgroup$