Deedle: errors using Frame.mapColValues

妖精的绣舞 提交于 2019-12-11 06:29:19

问题


I'm following a tutorial:
http://dkowalski.com/blog/archive/2014/01/11/f-deedle-and-computational-investing.aspx
and when I try to apply normalization to all the columns of "stocks" Frame, using Frame.mapColValues, I obtain the following error message:

System.InvalidOperationException: OptionalValue.Value: Value is not available in Deedle.OptionalValue``1.get_Value() in c:\Tomas\Public\Deedle\src\Deedle\Common\Common.fs:riga 35 in FSI_0046.normalized@52-8.Invoke(ObjectSeries``1 os) in C:\Users\Bruno-Astarita\Documents\Visual Studio 2013\Projects\TestDeedle02\TestDeedle02\TestTutorial01.fsx:riga 52 in <StartupCode$Deedle>.$Series.f@257-13[K,V,R](Func``3 f, Int32 i, K key, V v) in c:\Tomas\Public\Deedle\src\Deedle\Series.fs:riga 358 in <StartupCode$Deedle>.$Series.newVector@354-1.Invoke(Int32 i, Tuple``2 tupledArg) in c:\Tomas\Public\Deedle\src\Deedle\Series.fs:riga 355 in Microsoft.FSharp.Collections.IEnumerator.mapi@129.DoMoveNext(b& ) in Microsoft.FSharp.Collections.IEnumerator.MapEnumerator``1.System-Collections-IEnumerator-MoveNext() in Microsoft.FSharp.Collections.SeqModule.ToArray[T](IEnumerable``1 source) in Microsoft.FSharp.Collections.ArrayModule.OfSeq[T](IEnumerable``1 source) in Deedle.Series``2.Select[R](Func``3 f) in c:\Tomas\Public\Deedle\src\Deedle\Series.fs:riga 352 in Deedle.Series``2.Select[R](Func``2 f) in c:\Tomas\Public\Deedle\src\Deedle\Series.fs:riga 365 in Deedle.SeriesModule.MapValues[T,R,K](FSharpFunc``2 f, Series``2 series) in c:\Tomas\Public\Deedle\src\Deedle\SeriesModule.fs:riga 451 in <StartupCode$FSI_0046>.$FSI_0046.main@() in C:\Users\Bruno-Astarita\Documents\Visual Studio 2013\Projects\TestDeedle02\TestDeedle02\TestTutorial01.fsx:riga 49 Stopped due to error

I tried to find the problem making a step-by-step procedure based on source code in FrameModule.fs, and the error raises at the instruction Series.mapValues f. Where I'm wrong?
Many thanks.

Update
After many tests, the problem seems be arised by the row let firstItem = osAsFloat.GetAt(0) from the tutorial. If I try to substitute it with let firstItem = 2.0 everything is ok. Still is not clear for me this behaviour.


回答1:


Finally I found the reason of problem. In some Series in the Frame, there are missing values in correspondence to the first element. If I do not use those Series, everything is ok.



来源:https://stackoverflow.com/questions/26116602/deedle-errors-using-frame-mapcolvalues

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!