Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
F# Deedle IndexRows类型注释_F#_Deedle - Fatal编程技术网

F# Deedle IndexRows类型注释

F# Deedle IndexRows类型注释,f#,deedle,F#,Deedle,我试图为@migueldeicaza的小挑战实现一个Deedle解决方案,以实现在F#中使用python和R所做的事情。csv源数据可从链接获得 开始很简单,但现在,在尝试根据一系列浮点值进行排序时,我正在努力理解IndexRows类型注释的语法 #I "../packages/FSharp.Charting.0.90.5" #I "../packages/Deedle.0.9.12" #load "FSharp.Charting.fsx" #load "Deedle.fsx" open Sy

我试图为@migueldeicaza的小挑战实现一个Deedle解决方案,以实现在F#中使用python和R所做的事情。csv源数据可从链接获得

开始很简单,但现在,在尝试根据一系列浮点值进行排序时,我正在努力理解IndexRows类型注释的语法

#I "../packages/FSharp.Charting.0.90.5"
#I "../packages/Deedle.0.9.12"
#load "FSharp.Charting.fsx"
#load "Deedle.fsx"

open System
open Deedle
open FSharp.Charting

let bodyCountData = Frame.ReadCsv(__SOURCE_DIRECTORY__ + "/film_death_counts.csv")
bodyCountData?DeathsPerMinute <- bodyCountData?Body_Count / bodyCountData?Length_Minutes

// select top 3 rows based upon default ordinal indexer
bodyCountData.Rows.[0..3]

// create a new frame indexed and ordered by descending number of screen deaths per minute
let bodyCountDataOrdered =
    bodyCountData
    |> Frame.indexRows <float>"DeathsPerMinute" // uh oh error here - I'm confused
#I.。/packages/FSharp.Charting.0.90.5”
#I.“./包/数据包0.9.12”
#加载“FSharp.Charting.fsx”
#加载“Deedle.fsx”
开放系统
开放式Deedle
打开FSharp.Charting
让bodyCountData=Frame.ReadCsv(uuuu SOURCE\u DIRECTORY\uuuuuu+“/film\u death\u counts.csv”)
bodyCountData?DeathPerMinute Frame.indexRows“DeathPerMinute”//uh-oh错误-我很困惑
因为我不能理解这个语法。。。各种信息,如:

Error   1   The type '('a -> Frame<'c,Frame<int,string>>)' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface. See also c:\wd\RPythonFSharpDFChallenge\RPythonFSharpDFChallenge\EvilMovieQuery.fsx(18,4)-(19,22).    c:\wd\RPythonFSharpDFChallenge\RPythonFSharpDFChallenge\EvilMovieQuery.fsx  19  8   RPythonFSharpDFChallenge
Error   2   Type mismatch. Expecting a
    'a -> Frame<'c,Frame<int,string>>    
but given a
    'a -> float    
The type 'Frame<'a,Frame<int,string>>' does not match the type 'float'  c:\wd\RPythonFSharpDFChallenge\RPythonFSharpDFChallenge\EvilMovieQuery.fsx  19  25  RPythonFSharpDFChallenge
Error   3   This expression was expected to have type
    bool    
but here has type
    string  c:\wd\RPythonFSharpDFChallenge\RPythonFSharpDFChallenge\EvilMovieQuery.fsx  19  31  RPythonFSharpDFChallenge
错误1类型“('a->Frame”
但是给一个
'a->浮动

使用Deedle 1.0的“Frame类型,可以对任意列进行排序


请参阅:

当然可以-但是这里的语法变化会导致一些非常不同的错误,告诉我我知道我只是不知道如何将类型注释添加到deedle列:)看起来您不需要这里的
-实际上,您是对的,我看起来有点傻!bodyCountData |>Frame.indexRows“DeathSubMinute”是合法的-但它仍然失败,因为DeathSubMinute系列具有重复的值。我插入了类型注释,因为它是函数描述中的一个建议。有点傻。所以,我需要想一个办法来处理重复的问题。