Skip to content
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

[BREAKING] make id_vars go first in stack #2147

Merged
merged 3 commits into from
Mar 26, 2020

Conversation

bkamins
Copy link
Member

@bkamins bkamins commented Mar 9, 2020

Fixes #645.

Now we put id_vars first in the data frame returned from stack

@bkamins bkamins changed the title make id_vars go first in stack [BREAKING] make id_vars go first in stack Mar 9, 2020
@bkamins bkamins added the breaking The proposed change is breaking. label Mar 9, 2020
@bkamins bkamins added this to the 1.0 milestone Mar 9, 2020
@@ -55,14 +57,19 @@ function stack(df::AbstractDataFrame, measure_vars::AbstractVector{<:Integer},
id_vars::AbstractVector{<:Integer}; variable_name::Symbol=:variable,
value_name::Symbol=:value, view::Bool=false,
variable_eltype::Type=CategoricalString)
if stack_didnotwarn
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's a good idea to print this. There's no way to turn this off so it will annoying everybody. And if you relied on the columns order, you'll find out the problem soon enough.

The only way to deprecate this cleanly would be to introduce a keyword argument, but that would be quite annoying.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point is that I did not do a normal deprecation exactly because I do not want the message to be annoying. It will be printed only once per Julia session (as opposed a normal depwarn that would be printed every time).

The deprecation would only be in 0.21, in 1.0 release it will be gone.

@oxinabox, @pdeffebach - can you please comment on it from a "user's voice" perspective. Thank you!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as opposed a normal depwarn that would be printed every time).

is that still not fixed?

Rather than using a global you can do @warn msg maxlog=1
to prevent warning showing up more than once


I never use stack, only unstack, so i have no stake in this game.

Warnings are, in general are incredibly annoying.
I would rather a well-documented and breaking change than most warnings.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@warn msg maxlog=1

Thank you - one learns something all the time (I knew there should be a solution for this 😄). If we end up printing a deprecation warning I will change the implementation to use your tip.

@pdeffebach
Copy link
Contributor

I want to add that I think this is a good idea and I wonder if, despite allowing indexing by numbers, the order of columns shouldn't be considered a part of the API that we can "break". i.e., tell users not to rely on the order to columns in their code.

@bkamins
Copy link
Member Author

bkamins commented Mar 18, 2020

tell users not to rely on the order to columns in their code.

This probably should be a soft recommendation (as it is in other tabular data systems where you are typically advised to index column by name).

But in general sometimes indexing by a position is useful (and that is why we provide it) so I would be hesitant just to say that "the order of columns is undefined".

Anyway - the decision for this PR is to either

  1. print the warning once per session in 0.21 release, and drop the warning in 1.0 release.

or

  1. do not print the warning at all and just note in the release notes

(I would prefer option 1. as printing a warning only once is not that bad I think)

@nalimilan
Copy link
Member

I vote for 2. IIUC @oxinabox has the same preference, but he said he has no stake in this game, so... :-)

@bkamins
Copy link
Member Author

bkamins commented Mar 18, 2020

Well it seems only I want this warning to be printed. I have dropped it in the commit I have just pushed.

@bkamins bkamins merged commit d95eed7 into JuliaData:master Mar 26, 2020
@bkamins bkamins deleted the stack_idvars_first branch March 26, 2020 11:35
@bkamins
Copy link
Member Author

bkamins commented Mar 26, 2020

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking The proposed change is breaking.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Output format of reshape functions
4 participants