I have a Deedle frame in fsharp with 45 columns where every column contains floats. I'd like to create a new frame by applying a transformation to every entry in the original frame. The transformation is simple function as follows:

let minusLogOfOneLess x = -log (1.0-x)

Is there an easy way to do this?

有帮助吗?

解决方案

It looks like we've missed the unary minus operator when adding operators to Deedle frames! Aside from the unary minus, the rest actually works already.

So you can just change -log(...) to -1.0 * log(...):

let minusLogOfOneLess (x:Frame<_, _>) = -1.0 * (log (1.0 - x))

frame [ "A" => series [1=>0.5; 2=>0.4]]
|> minusLogOfOneLess 
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top