Skip to content

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

Closed

Description

@DrDryg

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

Activity

  1. ghost added
    in-prA pull request is open to resolve this issue
    on May 14, 2023
  2. ghost removed
    in-prA pull request is open to resolve this issue
    on Jul 6, 2023
  3. ghost locked as resolved and limited conversation to collaborators on Aug 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions