Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing the name of a column doesn't change the name you use to access the column #5916

Closed
Tracked by #6144
DrDryg opened this issue Aug 27, 2021 · 0 comments · Fixed by #6676
Closed
Tracked by #6144

Changing the name of a column doesn't change the name you use to access the column #5916

DrDryg opened this issue Aug 27, 2021 · 0 comments · Fixed by #6676
Labels
Microsoft.Data.Analysis All DataFrame related issues and PRs

Comments

@DrDryg
Copy link

DrDryg commented Aug 27, 2021

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.)

@michaelgsharp michaelgsharp added the Microsoft.Data.Analysis All DataFrame related issues and PRs label Sep 2, 2021
@ghost ghost added the in-pr label May 14, 2023
@ghost ghost removed the in-pr label Jul 6, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Aug 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Microsoft.Data.Analysis All DataFrame related issues and PRs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants