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

Explanation of the deprecation of df[col] and df[cols] #1897

Closed
stakaz opened this issue Jul 25, 2019 · 3 comments
Closed

Explanation of the deprecation of df[col] and df[cols] #1897

stakaz opened this issue Jul 25, 2019 · 3 comments

Comments

@stakaz
Copy link

stakaz commented Jul 25, 2019

Hello, unfortunately I can only found the new syntax df[!, col] and how to use it but I would like to know why this decision was made in the first place.

All my code is filled with df[col] and now I get thousands of thousands of deprecation warnings.
Also, the notation df[!, col] is much longer (in longer calculation is can be important) and when using df.col, you loose the syntax highlighting for the symbols, which makes the code less readable in my opinion.

A link to the discussion would be enough, thanks.

@bkamins
Copy link
Member

bkamins commented Jul 25, 2019

Here you have a summary:
https://discourse.julialang.org/t/release-announcements-for-dataframes-jl/18258/51

The issue was debated over for the last year or so so this is not an easy decision, but we decided to do it for the above reasons. Regarding updating of the deprecated syntax - I have done it for over 10 packages (also third party packages that I did not know) during the last two weeks, so I understand your pain. However, my experience was that what helps is r"\[:[\d\p{L}_]+\] regex (or something similar) that you can run through your source codes (it should generate a minimal number of false positives unless you are using dictionaries with Symbol as keys).

Maybe just let me add two things:

Also, the notation df[!, col] is much longer (in longer calculation is can be important)

If you are using such really long expressions where adding !, does make a difference consider using @where macro from DataFramesMeta.jl - it was designed exactly to handle such cases

when using df.col, you loose the syntax highlighting for the symbols

This is something that can be probably opened as an issue in the syntax highlighting package for your editor. What editor do you use?

@bkamins bkamins closed this as completed Jul 25, 2019
@stakaz
Copy link
Author

stakaz commented Jul 25, 2019

Hey, thanks for the quick reply. Now the reasons are clear. I will update my code to the getproperty version df.col when possible. Funny enough I use some dictionaries with symbols (I like the different coloring for the keys being symbols and for strings like Dict(:alpha = "\\alpha") or something similar, it is one character shorter ;) ) but that is ok, I can still go thought the code and skip this places manually.

@bkamins
Copy link
Member

bkamins commented Jul 25, 2019

😄 - I mentioned dicts exactly because this is what I suspected having read your initial post and seeing that you pay attention to such details (which is actually an interesting practice I think).

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

No branches or pull requests

2 participants