Skip to content

loc with one row cause error #597

Open
@Requiemu

Description

@Requiemu
let data = { "Name": ["Apples", "Mango", "Banana", "Pear"],
            "Count": [21, 5, 30, 10],
            "Price": [200, 300, 40, 250] }

let df = new dfd.DataFrame(data, {index: ["a", "b", "c", "d"]})
df.print()
let sub_df = df.loc({rows: ["a"]})
sub_df.print()

In browser, this will cause error:

Uncaught Error: IndexError: Specified index (a) not found
at t._loc (startup:4:47)
at t.loc (startup:4:47)
at pen.js?key=pen.js-8a2f7821-cb23-e0d2-07e7-2b53e94c09e0:7:17

This will only happen when the rows have exactly one element, if it's let sub_df = df.loc({rows: ["a", "b"]}), then it is normal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions