-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
convert for DataFrameRow #1575
convert for DataFrameRow #1575
Conversation
4bca511
to
bd9e1f7
Compare
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.
Thanks!
src/dataframerow/dataframerow.jl
Outdated
[dfr[i] for i in 1:length(dfr)] | ||
Base.convert(::Type{Vector{T}}, dfr::DataFrameRow) where T = | ||
T[dfr[i] for i in 1:length(dfr)] | ||
Base.Vector(dfr::DataFrameRow) = Base.convert(Vector, df) |
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.
No need for Base.
.
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.
Interesting - I did not think earlier abut such case. Where is this documented?
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.
Well, you never need to qualify calls to exported functions from other modules. You don't write Base.length
either, do you? :-)
EDIT: to be clear, I was talking about the RHS.
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.
Also, the CI failure is due to df
instead of dfr
.
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.
Sure - I thought you wanted to strip Base.
from Base.Vector
and got confused.
test/dataframerow.jl
Outdated
@test Vector(dfr) == Real[1, 2.0] | ||
@test eltype(Vector(dfr)) == Real | ||
@test Vector{Int}(dfr) == [1, 2] | ||
@test eltype(Vector{Int}(dfr)) == Int |
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.
Also test convert
directly.
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.
added
Actually, I'm a bit hesitant about whether |
OK - we can leave it as is. |
Thanks for the fixes. |
PR following discussion in #1564.