Pregunta

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?

¿Fue útil?

Solución

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 
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top