3

The help for Frame.tryValues has the following:

"Given a data frame containing columns of type tryval<'T>, returns a new data frame that contains the underlying values of type 'T."

I interpreted this as meaning that the function would strip the type tryval from values and return those stripped values. Maybe I did not understand the text because the function fails in the following case:

let dates  = 
  [ DateTime(2013,1,1); 
    DateTime(2013,1,2); 
    DateTime(2013,1,3) ]

let values = [ 10.0; 20.0; 30.0 ]

let first = Series(dates, values)

let frame = Frame(["first"], [first])

let f (dt: DateTime) (row: ObjectSeries<string>) = row.Get("first") :?> double

let s =
    frame
    |> Frame.tryMapRows f

// frame1's second column has tryvalues
let frame1 = Frame(["first"; "second"], [first; s])
// frame2 has no tryvalues
let frame2 = Frame(["first"; "second"], [first; first])

let frame3 =
    frame1
    |> Frame.tryValues
// fails

let frame3 =
    frame2
    |> Frame.tryValues
// Ok, works fine

Why does the first call to Frame.tryValues above fail but the second does not?

Soldalma
  • 4,636
  • 3
  • 25
  • 38

1 Answers1

4

This turns out to be a bug in Deedle. I looked into it and submitted a PR with a fix.

Tomas Petricek
  • 240,744
  • 19
  • 378
  • 553
  • I think `Deedle` is the best thing since sliced bread (in the `F#` universe). And I am proud to have contributed a tiny bit to its improvement. Many thanks. – Soldalma Mar 22 '17 at 12:57
  • You may also want to take a look at `SO 42912346`. I suspect a bug there. – Soldalma Mar 22 '17 at 13:03