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
CategoricalIndexis an “index”, it can keep looking up items by category values faster than using#where.@gnilrets Nothing.
I think in fact we should optimize
#whereirrelevant of whether we haveCategoricalIndexor not.So the question rises whether we should drop
CategoricalIndexbecause other things can accomplish the same? Inspite of my surrender to that all things which are accomplishable viaCategoricalIndexcan still be accomplished though other things, I’m still of the opinion thatCategoricalIndexis required to fills the gap for need to have non-unique indexing.What prevents us from refactoring #where to be as fast?