本文介绍了Deedle:使用Frame.mapColValues时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注一个教程:


,当我尝试使用 Frame.mapColValues 将归一化应用于股票框架的所有列,我得到以下错误消息:


System.InvalidOperationException:OptionalValue.Value:值不可用Deedle中的
.OptionalValue``1.get_Value()在c:\Tomas\Public\Deedle\src\ Deedle\Common\Common.fs:rig 35
[email protected](ObjectSeries``1 os)in C:\Users\Bruno-Astarita\Documents\Visual Studio 2013\项目\TestDeedle02\TestDeedle02\TestTutorial01.fsx:riga 52
in< StartupCode $ Deedle>。$ Series.f@257-13 [K,V,R](Func 3f,Int32 i,K键,V v)在< StartupCode $ Deedle>中的c:Tomas\Public\Deedle\src\Deedle\Series.fs:riga 358
中。 $ S [email protected](Int32 i,Tuple``2 tupledArg)in c:\Tomas\Public\Deedle\src\Deedle\Series.fs:riga 355
in [email protected](b& )Microsoft.FSharp.Collections.IEnumerator.MapEnumerator中的
``1.System-Collections-IEnumerator-MoveNext()Microsoft.FSharp.Collections.SeqModule.ToArray [T](IEnumerable``1中的
源)Microsoft.FSharp.Collections.ArrayModule.OfSeq [T]中的
(IEnumerable``1源)Deedle.Series``2.Select [R](Func``3 f)中的
c:Tomas\Public\Deedle\src\Deedle\Series.fs:riged 352
in Deedle.Series``2.Select [R](Func``2f)in c :: Tomas\Public\Deedle\src\Deedle\Series.fs:riged 365
in Deedle.SeriesModule.MapValues [T,R,K](FSharpFunc``2 f,Series` `2 series)在c:\Tomas\Public\Deedle\srcedDeedle\SeriesModule.fs:riga 451
in< StartupCode $ FSI_0046>。$ FSI_0046.main @()in C:\用户\Bruno-Astarita\文档\Visual Studio 2013\项目\TestDeedle02\TestDeedle02\TestTutorial01.fsx:riga 49
由于错误而停止



我试图根据 FrameModule.fs 中的源代码进行逐步操作的过程中发现问题并在 Series.mapValues f 指令处引发错误。
我错了?

非常感谢。



更新

经过多次测试,该问题似乎由行引起从教程中让firstItem = osAsFloat.GetAt(0)。如果我尝试用 let firstItem = 2.0 代替,一切都很好。

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 [email protected](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>[email protected](Int32 i, Tuple``2 tupledArg) in c:\Tomas\Public\Deedle\src\Deedle\Series.fs:riga 355 in [email protected](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 49Stopped 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.

推荐答案

最后,我找到了问题的原因。在框架中的某些系列中,缺少与第一个元素相对应的值。如果我不使用这些系列,那一切都会好的。

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.

这篇关于Deedle:使用Frame.mapColValues时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 04:42