-
Notifications
You must be signed in to change notification settings - Fork 50
Fix broken getindex methods, clean up the rest. Speed up find(*DataVector{Bool}). #24
Conversation
end | ||
function Base.getindex(x::Vector, | ||
inds::AbstractDataArray{Bool}) | ||
return x[find(array(inds, replace = false))] | ||
return x[find(array(inds, false))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can just be find(inds)
like the others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see an appropriate find
method:
da = @data [true false; NA true]
find(array(da, false)) # is fine
find(da) # find(A::AbstractArray{T,N}) at array.jl:1231 can't handle it
find(da[:, 1]) # find(dv::AbstractDataArray{Bool,1}) at datavector.jl:17 handles it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. Maybe we should fix the method signature for find
instead of working around that here, since find
in Base is happy to take n-dimensional arrays.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense -- happy to take a crack in the evening.
I'm a little confused by the mixture of calls to a version of |
I was basically just taking care of typos and and calls to deprecated functions without getting into design, but I cleared it up now. |
This is good to go. Could you squash these commits for a clean merge? |
Clean up getindex and find, remove calls to replaceNA
Thank you! |
No problem, I appreciate the direction. |
I noticed this because it was breaking subsetting of DataFrames by expression.