-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Microsoft.Data.AnalysisAll DataFrame related issues and PRsAll DataFrame related issues and PRs
Description
System Information (please complete the following information):
- OS & Version: [e.g. Windows 10]
- ML.NET Version: ML.NET 0.18.0
- .NET Version: .net Framework 4.8
Describe the bug
Changing the name of a column in a DataFrame doesn't change the name you use to access the column
To Reproduce
Steps to reproduce the behavior:
StringDataFrameColumn city = new StringDataFrameColumn("City", new string[] { "London", "Berlin" });
PrimitiveDataFrameColumn<int> temp = new PrimitiveDataFrameColumn<int>("Temperature", new int[] { 12, 13 });
DataFrame dataframe = new DataFrame(city, temp);
Console.WriteLine((string)dataframe["City"][0]);
// Change the name of the column:
dataframe["City"].SetName("Stadt");
// Still accessed as "City" but is named Stadt
Console.WriteLine(dataframe["City"].Name);
// Accessing as "Stadt" cause an exception
Console.WriteLine((string)dataframe["Stadt"][0]);
Expected behavior
That the column name inside the DataFrame gets updated so it can be accessed as:
dataframe["new name"]
Additional context
Would be great if one could change the name of a column and get a new column where the name is new but it points to the same data. (Useful for my use case, and perhaps valuable for others too.)
Metadata
Metadata
Assignees
Labels
Microsoft.Data.AnalysisAll DataFrame related issues and PRsAll DataFrame related issues and PRs