daru: Should we support duplicated keys in an index?
Daru::Vector.new([1,2,3], index: [1,1,1])
=> IndexError: Expected index size >= vector size. Index size : 1, vector size : 3
Daru::Index.new([1,1,1])
=> #<Daru::Index(1): {1}>
Index#initialize
uses @relation_hash = index.each_with_index.to_h.freeze
,
this causes
[1,2,1].each_with_index.to_h
=> {1=>2, 2=>1}
About this issue
- Original URL
- State: open
- Created 8 years ago
- Comments: 16 (12 by maintainers)
Since
CategoricalIndex
is an “index”, it can keep looking up items by category values faster than using#where
.@gnilrets Nothing.
I think in fact we should optimize
#where
irrelevant of whether we haveCategoricalIndex
or not.So the question rises whether we should drop
CategoricalIndex
because other things can accomplish the same? Inspite of my surrender to that all things which are accomplishable viaCategoricalIndex
can still be accomplished though other things, I’m still of the opinion thatCategoricalIndex
is required to fills the gap for need to have non-unique indexing.What prevents us from refactoring #where to be as fast?