-
Notifications
You must be signed in to change notification settings - Fork 373
Deprecate AbstractVector in hcat #2777
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
Conversation
|
+1 for only defining |
|
OK. Then we will only have Another problem I have noticed now is that currently we have: Which means that I think that both:
Should be deprecated and removed in 2.0 release. I imagine that in practice no-one uses these methods. I will ask on Slack. |
|
Users should definitely do Bummer this didn't make it into 1.0, though. It would seem we can't add the new methods until 2.0 because otherwise we would have to break |
No, we can add new methods, with the only exception that |
|
Is part of the problem here that telling people to call |
|
After thinking on this more, I think it's best to simply deprecate |
I think it is mostly convenience, like in |
|
Difficult decision. Adding a new method that works for all tables but gives a different result for |
|
I think what is safe to assume is that both |
|
OK. I think that then we should just deprecate |
|
CI fails because of time-out on Julia nightly so I guess it is acceptable for now. |
src/dataframe/dataframe.jl
Outdated
| hcat!(x, df::DataFrame; makeunique::Bool=false, copycols::Bool=true) = | ||
| throw(ArgumentError("x must AbstractDataFrame")) |
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.
Maybe we should drop this method? Other packages may define methods for x, so the error may not be completely accurate (since other types than AbstractDataFrame may be supported).
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.
The issue is that other packages will not affect hcat! but only potentially hcat. Still - I understand we could drop hcat(::Any, ::AbstractDataFrame) right?
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.
Ah right. Yes, we could probably drop both methods.
src/dataframe/dataframe.jl
Outdated
| throw(ArgumentError("x must AbstractDataFrame")) | ||
|
|
||
| function hcat!(df::DataFrame, x::AbstractVector; makeunique::Bool=false, copycols::Bool=true) | ||
| Base.depwarn("horizontal concatenation of data frame with a vector is deprecated", :hcat!) |
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.
It would be nice to point users to a replacement. Even if it's verbose, maybe just use @deprecate so that they see the full syntax?
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.
We cannot use @deprecate as it would export hcat!. I will improve the message.
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 can do @deprecate ... ex=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.
Anyway - I need to write a deprecation for hcat not hcat!. Thank you for the hint though.
|
I have made a significant clean-up of the old design. Now it is much shorter, but covers what I hope we want. Probably it is best to check out the branch locally to make a review (to see the exact state of the definitions after the changes not the diff). Regarding deprecation, it was unmanageable to write correct deprecation for cases like e.g.: as we currently allow them. So I just added an additional explanation to wrap a vector in a |
| throw(ArgumentError("x must be AbstractVector or AbstractDataFrame")) | ||
| hcat!(df::DataFrame, x; makeunique::Bool=false, copycols::Bool=true) = | ||
| throw(ArgumentError("x must be AbstractVector or AbstractDataFrame")) | ||
| # TODO: after deprecation remove AbstractVector methods |
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.
How about moving all of these to deprecated.jl?
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.
It will be easier to keep them here, as I will have to change the method in line https://github.com/JuliaData/DataFrames.jl/pull/2777/files#diff-151ff71ca0da68d81f47f5ffffb30d032f8b63682ac14ba5c81305b4836dd3a3R1047 here anyway + most likely we will add the methods handling Tables.jl tables.
In conclusion: I think it will be less error prone to keep all the code that needs to be changed in one place.
Co-authored-by: Milan Bouchet-Valat <nalimilan@club.fr>
|
We have the following issue:
However, we get two package compilation issues: JuliaData/Missings.jl#134 and KristofferC/Crayons.jl#45 which I do not understand. Also precompilation gives the following warnings on Julia nightly: although the statements were auto-generated by SnoopCompile.jl. @timholy - could you please confirm that these precompilation warnings are not a problem before I merge this (I assume this is not a problem as they should be just ignored, but I would like to double check). Thank you! |
|
Thank you! |
Preparation for #2776
This is a draft. Finalizing is required, docs update, news update, test update
Things to discuss before I move forward:
vcat(like inappend!)?hcat(df, table)andhcat(table, df)always produces aDataFrame; this could lead to dispatch ambiguities in case if othertabletype also definedhcat(and allowed it withDataFrame) - what do you think we should do? Maybe onlyhcat(df, table)should be defined and we should use a rule that the first argument governs the dispatch and output type?