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

Vector#uniq fails on category vectors #514

Open
parzydlo opened this issue Jun 25, 2019 · 1 comment
Open

Vector#uniq fails on category vectors #514

parzydlo opened this issue Jun 25, 2019 · 1 comment

Comments

@parzydlo
Copy link

I could not find information on whether this is expected bahaviour or not.
It seems like the uniq method is missing in category.rb

>> v = Daru::Vector.new(['a','b','c'])
=> #<Daru::Vector(3)>
   0   a
   1   b
   2   c
>> v.uniq
=> #<Daru::Vector(3)>
   0   a
   1   b
   2   c
>> v.to_category.uniq
Traceback (most recent call last):
        5: from /Users/jan/.rvm/rubies/ruby-2.6.0/bin/irb:23:in `<main>'
        4: from /Users/jan/.rvm/rubies/ruby-2.6.0/bin/irb:23:in `load'
        3: from /Users/jan/.rvm/rubies/ruby-2.6.0/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `<top (required)>'
        2: from (irb):14
        1: from /Users/jan/.rvm/gems/ruby-2.6.0/gems/daru-0.2.1/lib/daru/vector.rb:575:in `uniq'
NoMethodError (undefined method `uniq' for nil:NilClass)
@ncs1
Copy link
Contributor

ncs1 commented Aug 16, 2019

When you create a Vector extending Daru::Category the data local member is nil, and so you receive this error.
Looking on initialize_category & initialize_core_attributes (which are called on to_category and have access to the data) it isn't seem that the data member is being set.
I don't know if it's an expected behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants