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?