I created a Deedle DataFrame with this code:
type Person = { Name: string; Age: int; Gender: string; }
let people =
[ { Name = "Alice"; Age = 25; Gender = "Female" }
{ Name = "Bob"; Age = 30; Gender = "Male" }
{ Name = "Carol"; Age = 22; Gender = "Female" }
{ Name = "David"; Age = 35; Gender = "Male" } ]
let df = Frame.ofRecords people
It should have four rows and three columns. However,
df.ColumnCount;;
val it: int = 6
There are three additional columns Name@, Age@ and Gender@. Why is this happening?
I tried to put semicolons and commas separating the elements of the list that defines 'people' but that did not help.
This is a quirk of
dotnet fsi. This codeproduces the following output in FSI:
but different output in
dotnet repland VS Code with the Polyglot Notebooks plugin:When FSI creates the record type, it makes the fields public.
The explanation seems to be that by default FSI may create different assemblies for different inputs, and it needs all assemblies to "see" all members of types of other assemblies.
This can be disabled via a command line parameter (the following is an excerpt from the output of
dotnet fsi --help):I.e. instead of
dotnet fsiyou rundotnet fsi --multiemit-.