System Information (please complete the following information):
- OS & Version: Windows 10
- ML.NET Version: ML.NET v2.0.1
- .NET Version: .NET 7.0.1
Describe the bug
When renaming a DataFrameColumn with .SetName(), the name is not updated in the internal _columnNameToIndexDictionary, causing operations using it (like .IndexOf()) to fail
To Reproduce
Steps to reproduce the behavior:
- Create a new project with the ML.NET librarys and run the sample code below
Expected behavior
In the code below, .IndexOf() should return 0. It instead returns -1, indicating that the column wasn't found
Screenshots, Code, Sample Projects
var dataFrame = new DataFrame(new SingleDataFrameColumn("OldName"));
dataFrame.Columns[0].SetName("NewName");
Console.WriteLine(dataFrame.Columns.IndexOf("NewName"));
Additional context
Unsure if any other functions are affected, I only noticed it with .IndexOf(). If you take a look at the private _columnNameToIndexDictionary, you'll see that the column still has its old name and thus will fail when looking for the new name