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

MultiIndex [] method working with invalid indexes #61

Closed
lokeshh opened this issue Feb 26, 2016 · 0 comments
Closed

MultiIndex [] method working with invalid indexes #61

lokeshh opened this issue Feb 26, 2016 · 0 comments
Labels

Comments

@lokeshh
Copy link
Member

lokeshh commented Feb 26, 2016

[1] pry(main)> d =        Daru::MultiIndex.from_tuples([
[1] pry(main)*     [:c,:one,:bar],            
[1] pry(main)*     [:c,:one,:baz],            
[1] pry(main)*     [:c,:two,:foo],            
[1] pry(main)*     [:c,:two,:bar]            
[1] pry(main)* ])     
=> Daru::MultiIndex:18229240 (levels: [[:c], [:one, :two], [:bar, :baz, :foo]]
labels: [[0, 0, 0, 0], [0, 0, 1, 1], [0, 1, 2, 0]])
[2] pry(main)> v = Daru::Vector.new([1,2,3,4], index: d)
=> 
#<Daru::Vector:18002080 @name = nil @size = 4 >
                              nil
[:c, :one, :bar]                1
[:c, :one, :baz]                2
[:c, :two, :foo]                3
[:c, :two, :bar]                4

[4] pry(main)> v[:x, :one]
=> 
#<Daru::Vector:17572840 @name = nil @size = 2 >
          nil
[:bar]      1
[:baz]      2

But :x is not a valid index.

@v0dro v0dro added the bug label Feb 28, 2016
@v0dro v0dro closed this as completed in e776d78 Apr 3, 2016
v0dro added a commit that referenced this issue Apr 3, 2016
fixes #61 , MultiIndex #[] raises error on accessing invalid index
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants