f#-data

F# Immutable data structures for high frequency real-time streaming data

别说谁变了你拦得住时间么 提交于 2019-12-31 22:31:32
问题 We are at the beginning of an f# project involving real-time and historical analysis of streaming data. The data is contained in a c# object (see below) and is sent as part of a standard .net event. In real-time, the number of events we typically receive can vary greatly from less than 1/sec to upwards of around 800 events per second per instrument and thus can be very bursty. A typical day might accumulate 5 million rows/elements per insturment A generic version of the C# event's data

F# Immutable data structures for high frequency real-time streaming data

好久不见. 提交于 2019-12-31 22:31:08
问题 We are at the beginning of an f# project involving real-time and historical analysis of streaming data. The data is contained in a c# object (see below) and is sent as part of a standard .net event. In real-time, the number of events we typically receive can vary greatly from less than 1/sec to upwards of around 800 events per second per instrument and thus can be very bursty. A typical day might accumulate 5 million rows/elements per insturment A generic version of the C# event's data

F# Interactive CsvProvider not defined

允我心安 提交于 2019-12-24 00:34:19
问题 I'm loading FSharp.Data in the interactive console. The library is loaded without any problem: > #r "FSharp.Data.dll";; --> Referenced 'C:\Users\pw\AppData\Local\Temp\FSharp.Data.dll' (file may be locked by F# Interactive process) > open FSharp.Data;; However, when I'm trying to initialize CsvProvider (defined in FSharp.Data ) I get the error message saying the type is not defined: > type Stocks = CsvProvider<"C:\Users\pw\Downloads\msft.csv">;; type Stocks = CsvProvider<"C:\Users\pw\Downloads

Add calculated key to collection

穿精又带淫゛_ 提交于 2019-12-23 16:24:45
问题 Please consider this dataset, composed by man and woman, and that I filter in a second moment according to few variables: type ls = JsonProvider<"..."> let dt = ls.GetSamples() let dt2 = dt |> Seq.filter (fun c -> c.Sex = "male" && c.Height > Some 150) dt2 [{"sex":"male","height":180,"weight":85}, {"sex":"male","height":160" "weight":60}, {"sex":"male","height":180,"weight":85}] Lets suppose that I would like to add a fourth key "body mass index" or "bmi", and that its value is roughly given

F# Data: JSON Parser. Using JsonExtensions

核能气质少年 提交于 2019-12-23 16:19:17
问题 It is my first question on SO...so do not judge strictly =) Usually all my questions techout in chat rooms (believe me, a lot of them =)). Recently, we are talking about the RosettaCode. And I wondered to complement some of the tasks code to F# One of them is JSON. One of the possible solutions is the use of "F# Data: JSON Parser". So my question is linked with it. This code works well: open FSharp.Data open FSharp.Data.JsonExtensions type Person = {ID: int; Name:string} let json = """[ { "ID

Preserving Field names across the F#/C# boundary

久未见 提交于 2019-12-23 15:28:37
问题 As a learning exercise, I am doing some data analysis on a 5000-line csv file using F# and F#'s type-provider functionality. When I use the type-provider-generated type in f#, naturally the header rows of the csv file become the field names of the type. type restaurantCsv = CsvProvider<"C:\Users\Paul\Desktop\HealthDepartment\RestaurantRatings2013.csv",HasHeaders=true> type RawInspectionData(filename : string) = member this.allData = restaurantCsv.Load(filename) member public this

Reusing type definitions with JSONProvider?

时光总嘲笑我的痴心妄想 提交于 2019-12-23 10:26:58
问题 I'm using the JSONProvider from FSharp-Data to automatically create types for a webservice that I'm consuming using sample responses from the service. However I'm a bit confused when it comes to types that are reused in the service, like for example there is one api method that return a single item of type X while another returns a list of X and so on. Do I really have to generate multiple definitions for this, and won't that mean that I will have duplicate types for the same thing? So, I

Type annotation for using a F# TypeProvider type e.g. FSharp.Data.JsonProvider<…>.DomainTypes.Url

不羁的心 提交于 2019-12-23 09:30:00
问题 I'm using the FSharp.Data.JsonProvider to read Twitter Tweets. Playing with this sample code https://github.com/tpetricek/Documents/tree/master/Samples/Twitter.API I want to expand the urls in the tweet with let expandUrl (txt:string) (url:Search.DomainTypes<...>.DomainTypes.Url) = txt.Replace( url.Url, url.ExpandedUrl ) This results in Error: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to

Data sample for JSON type provider with optional property

蹲街弑〆低调 提交于 2019-12-23 09:19:48
问题 I am trying to use the JSON type provider to access StackOverflow / StackExchange data via the API. It works great, with one caveat. The API has a throttle, which is signaled by a field "backoff" that contains the number of seconds you are supposed to back off until your next request. As a result, I can't just point the JSON TP to the url, because by default the backoff field is not present. This is how the response typically looks: { "items": [ { "has_synonyms": true, "user_id": 1144035, "is

FSharp.Data 'System.MissingMethodException' when calling Freebase Provider from C#

落花浮王杯 提交于 2019-12-20 03:53:22
问题 Hi I have this piece of code on F#, if I test it from the F# Interactive Editor both isPalindrome and Extract methods work well: namespace Portable3 open FSharp open FSharp.Data open Microsoft.FSharp.Linq open FSharp.Data.FreebaseOperators open MyTrip.Model.MyTrip open MyTrip.Model.FreeBase open System.Runtime open System.Linq module math = let isPalindrome (str : string) = let rec check(s : int, e : int) = if s = e then true elif str.[s] <> str.[e] then false else check(s + 1, e - 1) check(0