deedle

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

倾然丶 夕夏残阳落幕 提交于 2019-12-13 16:32:53
问题 This question is related to Working with missing values in Deedle Time Series in F# (1) Suppose i have a Series<'K,'T opt> with some missing values For example i have obtained a series series4;; val it : Series<int,int opt> = 1 -> 1 2 -> 2 3 -> 3 4 -> <missing> I could have got it 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

How to deal with null (missing) values in a deedle series in C#?

a 夏天 提交于 2019-12-13 08:01:27
问题 How should I deal with missing values in a deedle series? For example, I have a series with fields Name and BirthDate , where BirthDate is initially DateTime? and I need to convert BirthDate to String . var newDOB = df.GetColumn<DateTime?>("DOB").Select(x => x.Value.Value != null ? x.Value.Value.ToString("dd/MM/yyyy") : " "); df.ReplaceColumn("DOB", newDOB); This is what I tried and it does not work. What is the best way to convert a missing DateTime? value to string for me? And what is the

Deedle Frame.mapRows how to properly use it and how to construct objectseries properly

℡╲_俬逩灬. 提交于 2019-12-11 09:11:55
问题 I also noticed something strange about Deedle mapRows function i cant explain: let col1 = Series.ofObservations[1=>10.0;2=>System.Double.NaN;3=>System.Double.NaN;4=>10.0;5=>System.Double.NaN;6=>10.0; ] let col2 = Series.ofObservations[1=>9.0;2=>5.5;3=>System.Double.NaN;4=>9.0;5=>System.Double.NaN;6=>9.0; ] let f1 = Frame.ofColumns [ "c1" => col1; "c2" => col2 ] let f2 = f1 |> Frame.mapRows (fun k r -> r) |> Frame.ofRows let f3 = f1 |> Frame.mapRows (fun k r -> let x = r.Get("c1"); let y = r

Deedle moving window stats calcuation with a dynamic condition and boundary.atending

*爱你&永不变心* 提交于 2019-12-11 08:26:57
问题 I am using a dynamic moving window to calculation simple stats on a series ordered on the date key. I want to be able to set the boundary at the end of the window. for example a timeseries with monthly moving average, the monthly is decided by a (fun d1 d2 -> d1.addMonths(1) <= d2) however the deedle series function windowWhileInto cond f series always uses the begin as the boundary. Therefore, it always creates produce a n datapoints series from the first data instance for the next n data

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:

Plotting data of deedle data frame with Xplot plotly

血红的双手。 提交于 2019-12-10 11:16:47
问题 I have a Deedle data frame with DateTime values as key and two columns with data. Now I want to plot the data of column 1 with a Scatter chart from Plotly. I am using FSLab and there is XPlot.Plotly 1.3.1 included. But I can't use Plotly: open XPlot.Plotly.Graph open XPlot.Plotly open XPlot.Plotly.HTML let dataFrame = ... Scatter( x = dataFrame.ColumnKeys, y = dataFrame.GetColumn("col1") ) |> Chart.Plot |> Chart.Show I'm getting this error: "The field, constructor or member 'Plot' is not

Map to Deedle Frame

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-07 22:15:03
问题 I am learning F#. I am trying to convert a Map<string, seq<DateTime * float>> to a Deedle dataframe (http://bluemountaincapital.github.io/Deedle/tutorial.html#creating). I have prapared the following code: let folderFnct (aFrame:Frame) colName datesAndValues = let newSerie = Series(Seq.map (fun x -> fst x) datesAndValues, Seq.map (fun y -> snd y) datesAndValues) let newFrame = aFrame.Join([colName], [newSerie], kind=JoinKind.Inner) newFrame let mapToDeedleFrame myMap frame = Map.fold ( fun s

Change column order in deedle frame

落花浮王杯 提交于 2019-12-07 09:12:01
问题 What is the best way to change column order in deedle frame? For example if I have a deedle frame df with columns height , Name , and phone , but I need it in order Name , phone , and height . 回答1: Deedle has RealignRows extension method, but it turns out that we don't have RealignColumns . This is an omission and if you send a PR to Deedle adding this, that would be awesome! It can be implemented by looking at the series of columns, realigning the columns and turning that back into a data

Map to Deedle Frame

回眸只為那壹抹淺笑 提交于 2019-12-06 12:38:55
I am learning F#. I am trying to convert a Map<string, seq<DateTime * float>> to a Deedle dataframe ( http://bluemountaincapital.github.io/Deedle/tutorial.html#creating ). I have prapared the following code: let folderFnct (aFrame:Frame) colName datesAndValues = let newSerie = Series(Seq.map (fun x -> fst x) datesAndValues, Seq.map (fun y -> snd y) datesAndValues) let newFrame = aFrame.Join([colName], [newSerie], kind=JoinKind.Inner) newFrame let mapToDeedleFrame myMap frame = Map.fold ( fun s ticker datesAndValues -> folderFnct s ticker datesAndValues) frame myMap mapToDeedleFrame folds the

Change column order in deedle frame

放肆的年华 提交于 2019-12-05 18:12:53
What is the best way to change column order in deedle frame? For example if I have a deedle frame df with columns height , Name , and phone , but I need it in order Name , phone , and height . Deedle has RealignRows extension method , but it turns out that we don't have RealignColumns . This is an omission and if you send a PR to Deedle adding this, that would be awesome! It can be implemented by looking at the series of columns, realigning the columns and turning that back into a data frame. In C#, this looks as follows: Frame.FromColumns(df.Columns.Realign(new[] { "key 1", "key 2" })); 来源: