dotnet / machinelearning

ML.NET is an open source and cross-platform machine learning framework for .NET.
https://dot.net/ml
MIT License
8.91k stars 1.86k forks source link

DataFrame NullCount property of StringDataFrameColumn works incorrectly #7089

Closed asmirnov82 closed 2 months ago

asmirnov82 commented 3 months ago

Describe the bug DataFrame NullCount property of StringDataFrameColumn works incorrectly in several scenarios:

  1. Using constructor with length property

    var strCol = new StringDataFrameColumn("String Column", 5);

    Actual behavior: creates string column with 5 null elements, however NullCount property is set to 0 Expected behavior: NullCount property is set to 5

  2. Clone method

    
    //creates string column with 3 null values and NullCount 3
    var strCol = new StringDataFrameColumn("String Column");

for (int i = 0; i < 3; i++) strCol.Append(null);

//Clone var clonedColumn = strCol.Clone();



Actual behavior: NullCount of cloned column is 0
Expected behavior: NullCount property is set to 5