4

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?

Vijesh
  • 251
  • 2
  • 8

1 Answers1

3

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 
Tomas Petricek
  • 240,744
  • 19
  • 378
  • 553