You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am running into an issue where a Frame is "losing" its column's initial data types when the Frame is filtered to only contain rows where the column's values are missing. Pardon the C#-isms in advance, I am using Deedle from C# code, but hopefully this is all clear.
Steps to reproduce the issue
Start with a Frame where one of the columns can be null. In this example, we start with a frame where the columns are of type string ("Name" field) and int? ("Age" field).
Inspecting the frame.ColumnTypes directly after the frame is created below using Frame.FromRecords results in the expected types of string and int? being output.
Create a new frame by filtering out rows where the nullable column has values, i.e. filter to rows where no row has values for a given column. In this simple case where we have 2 Person records, I filter to index 0 aka the "Alice" record where Age is null.
Inspecting the filtered.ColumnTypes produces an unexpected result of the "Age" column having a type of System.Object.
Person[]records=new Person[]{new Person(){Name="Alice",Age=null},new Person(){Name="Bob",Age=45}};Frame<int,string>frame= Frame.FromRecords(records);//Output of `frame.ColumnTypes` is the expected `string`, `int?`Frame<int,string>filtered= frame.Where(c => c.Key ==0);Frame<int,string>filtered= Frame.FromRows(frame.Rows.Where(c => c.Key ==0));//After filtering (done in the 2 different ways I am aware of for filtering rows), the `filtered.ColumnTypes` property returns types//`string` and `Object` when that 2nd type should still be `int?`
What's the expected result?
After filtering, the ColumnTypes pre and post-filtering should not change.
What's the actual result?
After filtering, the type of the column that only had null / missing values changes to System.Object from whatever its previous, correct type was (in my example, after filtering, the type of the Age column changes from typeof(Int32?) to typeof(Object).
The text was updated successfully, but these errors were encountered:
ppatino
changed the title
ColumnTypes change to System.Object when filtering frame to rows where the column are nullframe.ColumnTypes incorrectly changes to System.Object when filtering frame to rows where the column's values are null
Sep 22, 2020
in which case the rows are appropriately filtered (in this case simply to index 0) AND the frame.ColumnTypes appears to be correct after this (i.e. types are string, int?).
Issue description
I am running into an issue where a Frame is "losing" its column's initial data types when the Frame is filtered to only contain rows where the column's values are missing. Pardon the C#-isms in advance, I am using
Deedle
from C# code, but hopefully this is all clear.Steps to reproduce the issue
string
("Name" field) andint?
("Age" field).frame.ColumnTypes
directly after the frame is created below usingFrame.FromRecords
results in the expected types ofstring
andint?
being output.Person
records, I filter to index0
aka the "Alice" record where Age is null.filtered.ColumnTypes
produces an unexpected result of the "Age" column having a type ofSystem.Object
.What's the expected result?
ColumnTypes
pre and post-filtering should not change.What's the actual result?
System.Object
from whatever its previous, correct type was (in my example, after filtering, the type of theAge
column changes from typeof(Int32?) to typeof(Object).The text was updated successfully, but these errors were encountered: