Why is Frame.tryValues failing with this simple example?
Help for Frame.tryValues
has the following:
"Given a data frame containing columns of the type tryval<'T>
, returns a new data frame that contains the underlying values of the type 'T
."
I interpreted this to mean that the function will split the type tryval
into values and return those separated values. Perhaps I did not understand the text, because the function does not work 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 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 Frame.tryValues
does the first call above fail and the second not?
+3
source to share