SciRuby / daru

Data Analysis in RUby
BSD 2-Clause "Simplified" License
1.04k stars 139 forks source link

Define Daru::Index#[] to take only index value as argument #332

Closed ananyo2012 closed 7 years ago

ananyo2012 commented 7 years ago

Daru::Index#[] now only takes index values and returns positions only. If index is not found it returns nil

2.3.0 :001 > index = Daru::Index.new [:one, :two, :three, :four] => #<Daru::Index(4): {one, two, three, four}> 
2.3.0 :002 > index[:one..:three] 
 => [0, 1, 2] 
2.3.0 :003 > index[:five..:six]
 => nil 
2.3.0 :004 > index[:one, 0]
 => [0, nil] 
2.3.0 :005 > index[:two]
 => 1 
2.3.0 :006 > index[2]
 => nil 
ananyo2012 commented 7 years ago

@v0dro @zverok Review please.

ananyo2012 commented 7 years ago

Hi @zverok @v0dro Just thought to ping ypu since its been 4 days since the PR.

zverok commented 7 years ago

I'll review it tomorrow. Lots of stuff is going on currently, 4 days of PR review delay is not that much by OSS standards :trollface:

athityakumar commented 7 years ago

@zverok - The troll though :joy:

ananyo2012 commented 7 years ago

Hi @zverok @v0dro . I had my final exams so couldn't check on this. I see there are some merge conflicts. Will solve it and put it for review again

ananyo2012 commented 7 years ago

Please have a look at it once again.

zverok commented 7 years ago

Thanks for your hard work!

ananyo2012 commented 7 years ago

Thanks! Will take up a new issue soon.