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

DataFrameColumn.And System.NotSupportedException: Specified method is not supported. #7091

Closed RaphaelPliessnig closed 3 months ago

RaphaelPliessnig commented 3 months ago

Since i upgraded to Data.Analysis 21.1 from 20.0 the ".And" method does not work anymore. I also cant "downgrade to 20.0 anymore since i get this error: Error: Microsoft.DotNet.Interactive.KernelExtensionLoadException: Failure loading Kernel Extension

#r "nuget: Microsoft.Data.Analysis, 0.21.1"

using System;

using Microsoft.Data.Analysis;

var col1 = new BooleanDataFrameColumn("col1", new Boolean[]{true, false, true});
var col2 = new BooleanDataFrameColumn("col2", new Boolean[]{false, true, true});
var dfTest = new DataFrame(col1,col2);
dfTest["and"] = dfTest["col1"].And(dfTest["col2"])

before the update to 21.1 everything worked as expected but i am now getting this error: Error: System.NotSupportedException: Specified method is not supported. at Microsoft.Data.Analysis.PrimitiveDataFrameColumn1.HandleOperationImplementation[U](BinaryOperation operation, PrimitiveDataFrameColumn1 column, Boolean inPlace) at Microsoft.Data.Analysis.PrimitiveDataFrameColumn1.And(DataFrameColumn column, Boolean inPlace) at Submission#3.<<Initialize>>d__0.MoveNext() --- End of stack trace from previous location --- at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult](ImmutableArray1 precedingExecutors, Func2 currentExecutor, StrongBox1 exceptionHolderOpt, Func`2 catchExceptionOpt, CancellationToken cancellationToken)

am i missing some dependencies or is this method just no longer supported?

Thank you in advance

asmirnov82 commented 3 months ago

Hello @RaphaelPliessnig Thanks for reporting the defect. Fix is ready https://github.com/dotnet/machinelearning/pull/7093

@JakeRadMSFT can we release 0.21.2 version with the latest fixes?

While fix is not released you may change you code to this:

var col1 = new BooleanDataFrameColumn("col1", new Boolean[]{true, false, true});
var col2 = new BooleanDataFrameColumn("col2", new Boolean[]{false, true, true});
var dfTest = new DataFrame(col1,col2);
dfTest["and"] = col1.And(col2)

this should help.

RaphaelPliessnig commented 3 months ago

Thank you very much. The workaround helps!