deedle

How to get the position of the row with some key from a Deedle Frame<DateTime,_>?

大城市里の小女人 提交于 2021-01-29 02:49:11
问题 By position I mean: let position:int = positionForKey frame key let row = Frame.take positionForKey |> frame.takeLast 1 Then, row should be a Frame with only one row, whose key is key . What I don't know is how to achieve positionForKey . One idea that should work but I don't know if it's the best way of doing it would be to create another Series via Series.scanValues and let the values be the positions, but I think there oughts to be a more elegant way of doing it. The implementation via

How to get the position of the row with some key from a Deedle Frame<DateTime,_>?

大兔子大兔子 提交于 2021-01-29 02:45:53
问题 By position I mean: let position:int = positionForKey frame key let row = Frame.take positionForKey |> frame.takeLast 1 Then, row should be a Frame with only one row, whose key is key . What I don't know is how to achieve positionForKey . One idea that should work but I don't know if it's the best way of doing it would be to create another Series via Series.scanValues and let the values be the positions, but I think there oughts to be a more elegant way of doing it. The implementation via

Adding two columns using Deedle in C#

我是研究僧i 提交于 2020-01-24 21:45:06
问题 Given the following CSV file A,B 2,3 5,7 9,11 I'd like to add the two columns, resulting in A,B,C 2,3,5 5,7,12 9,11,20 using C# and Deedle. using Deedle; using System.IO; using System.Linq; namespace NS { class AddTwoColumns { static void main(string[] args) { var root = "path/to"; var df = Frame.ReadCsv(Path.Combine(root, "data.csv")); var a = df.GetColumn<int>("A"); var b = df.GetColumn<int>("B"); var c = df.Select(x => x.a + x.b); df.AddColumn("C", c); df.Print(); } } } Neither the

Working with missing values in Deedle Time Series in F# (1)

痴心易碎 提交于 2020-01-24 10:21:06
问题 here is a small example where I want to deal with missing values on custom functions on series. suppose that i have obtained a series series4;; val it : Series<int,int opt> = 1 -> 1 2 -> 2 3 -> 3 4 -> <missing> for example, this way: let series1 = Series.ofObservations [(1,1);(2,2);(3,3)] let series2 = Series.ofObservations [(1,2);(2,2);(3,1);(4,4)] let series3 = series1.Zip(series2,JoinKind.Outer);; let series4 = series3 |> Series.mapValues fst Then if i do, Series.mapAll (fun v -> match v

Deedle - what's the schema format for readCsv

陌路散爱 提交于 2020-01-05 04:39:05
问题 I was using Deedle in F# to read a txt file (no header) to data frame, and cannot find any example about how to specify the schema. let df= Frame.ReadCsv(datafile, separators="\t", hasHeaders=false, schema=schema) I tried to give a string with names separated by ',', but seems don't work. let schema = @"name, age, address"; I did some search on the doc, but only find following - don't know where I can find the info. :( schema - A string that specifies CSV schema. See the documentation for

Count unique in a Deedle Series

て烟熏妆下的殇ゞ 提交于 2020-01-03 17:29:11
问题 I want to have an overview of a Series in my dataframe, something like pandas' unique values counting. I don't know if there's a built-in function for that. So far i've done a function to just get the numbers of different features. I could manage to do the job, my question is only about a built-in function. let unique (s:Deedle.Series<'a,'a>) = s.Values |>Seq.distinct |>Seq.length I want a result like : [("value1",5);("value2",8)] 回答1: You can use the groupInto function - this lets you group

Why Frame.X static methods from Deedle are generating warnings in VS 2017?

廉价感情. 提交于 2019-12-30 17:45:39
问题 I downloaded the new VS 2017 yesterday and it is working fine, except that I am getting this warning on every line where I call the static method Frame.ReadCsv from the Deedle package: FS10001 This method is not intended for use from F# Calls to other static methods Frame.X do not generate the same warning. Example - this line of code generates the warning: let msft = Frame.ReadCsv(Config.tsDir + "MSFT.csv", hasHeaders=true, inferTypes=true) Intellisense recognizes the method and provides the

Select Specific Rows in Deedle

余生长醉 提交于 2019-12-24 05:13:08
问题 I have a deedle data frame, called df, with one of the columns named TimeSpent . I would like to keep the rows, which have values for TimeSpent greater than a specific TimeSpan (e.g. 30 minutes). I could only manage to keep the rows with a specific TimeSpan (30 min) by using FilterRowsBy() df = df.FilterRowsBy<int, string, TimeSpan>("TimeSpent", new TimeSpan(0, 30, 0)); How do you filter a deedle data frame for a certain range? UPDATE: So, I decided to try to sort the deedle frame by TimeSpan

Plotting Deedle frame

谁说我不能喝 提交于 2019-12-23 20:14:50
问题 I have the following piece of code: let mychart = frame.GetAllSeries() |> Seq.iter(fun key value -> Chart.Line(value, Name=key) |> Chart.Combine where frame.GetAllSeries() returns a seq<KeyValuePair> . I'd like to pipe the sequence directly in a chart. I thought I could iterate through the sequence. The problem is that I can't find an idomatic way to access the key and value separately that could be plugged in directly in the lambda expression. Thanks. EDIT This works: let chart = frame

Worse multithreaded performance on better system (possibly due to Deedle) [closed]

大兔子大兔子 提交于 2019-12-13 17:26:36
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . We are dealing with a multithreaded C# service using Deedle. Tests on a quad-core current system versus an octa-core target system show that the service is about two times slower on the target system instead of two times faster. Even when restricting the number of threads to two,