Skip to content

Instantly share code, notes, and snippets.

@matthewcrews
Created May 6, 2021 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewcrews/55c86ccf642c344ac6385bc31b29e062 to your computer and use it in GitHub Desktop.
Save matthewcrews/55c86ccf642c344ac6385bc31b29e062 to your computer and use it in GitHub Desktop.
CsvProvider failing on 2 column data
#r "nuget: FSharp.Data, 4.1.1"
open FSharp.Data
type TimeData = CsvProvider<"ExampleDates.csv">
let data = TimeData.Load $"{__SOURCE_DIRECTORY__}\\ExampleDates.csv"
let analysis =
data.Rows
|> Seq.map (fun row -> row.ExampleDateTime.Hour)
|> Seq.groupBy id
|> Seq.map (fun (hour, grp) -> hour, Seq.length grp)
ExampleId ExampleDateTime
ABC001 2020-02-14 02:00:00.000
ABC002 2021-01-03 16:30:00.000
ABC003 2021-03-17 05:00:00.000
ABC004 2021-05-05 21:00:00.000
ABC005 2021-05-04 08:00:00.000
ABC006 2021-05-03 10:00:00.000
ABC007 2021-05-06 06:00:00.000
ABC008 2021-05-06 04:00:00.000
ABC009 2021-05-06 04:00:00.000
@matthewcrews
Copy link
Author

This fails on line 10 saying:

CsvProvider2Column.fsx(11,32): error FS0039: The type 'Row' does not define the field, constructor or member 'ExampleDateTime'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment