Skip to content

If dataframe has column called 'index,' df.index refers to the column, causing hard-to-decipher errors. #550

Open
@maxhosler

Description

@maxhosler

Describe the bug
When creating a DataFrame by providing an Object, if one of the columns is called 'index,' then 'df.indexwill point to that column instead of the actualDataFrame` index. This caused very hard-to-decipher errors when I was working with a table I did not know contained such a column.

To Reproduce

let obj = {
foo: [1,2,3,4,5],
bar: [5,6,7,8,9],
index: ['a','b','c','d','e']
}
df = new DataFrame(obj).setIndex('foo')

df.index.includes(1) //Throws error

Expected behavior
df.index should give the index of df. Failing that, a warning that I've created a DataFrame with a column named index.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions