Last active
June 11, 2016 20:15
-
-
Save lokeshh/cfb01ff54845e09968f9625bd64965d7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [1] pry(main)> dv = Daru::Vector.new ['third', 'third', 'first', 'second'], type: :category | |
| => #<Daru::Vector(4)> | |
| 0 third | |
| 1 third | |
| 2 first | |
| 3 second | |
| [2] pry(main)> dv.order | |
| => ["third", "first", "second"] | |
| [3] pry(main)> dv.order = ['first', 'second', 'thrd'] | |
| ArgumentError: The contents of new and old order must be the same. | |
| from /home/ubuntu/workspace/daru/lib/daru/category.rb:124:in `order=' | |
| [4] pry(main)> dv.order = ['first', 'second', 'third'] | |
| => ["first", "second", "third"] | |
| [5] pry(main)> dv.sort! | |
| ArgumentError: Can not apply sort when vector is unordered | |
| from /home/ubuntu/workspace/daru/lib/daru/category.rb:238:in `assert_ordered' | |
| [6] pry(main)> dv.ordered = true | |
| => true | |
| [7] pry(main)> dv.sort! | |
| => #<Daru::Vector(4)> | |
| 2 first | |
| 3 second | |
| 0 third | |
| 1 third | |
| [9] pry(main)> dv.eq 'third' | |
| => #<Daru::Core::Query::BoolArray:10944520 bool_arry=[false, false, true, true]> | |
| [10] pry(main)> dv.where(dv.mt 'first') | |
| => #<Daru::Vector(3)> | |
| 3 second | |
| 0 third | |
| 1 third |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment