-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
DEPR: Deprecate pandas.core.datetools #14105
DEPR: Deprecate pandas.core.datetools #14105
Conversation
Current coverage is 85.26% (diff: 78.26%)@@ master #14105 diff @@
==========================================
Files 139 140 +1
Lines 50562 50604 +42
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 43116 43149 +33
- Misses 7446 7455 +9
Partials 0 0
|
Can you leave out the changes in the benchmarks? (Avoiding conflicts with my pr, i will incorporate changes there) |
@jorisvandenbossche : Ah, I didn't see #14099. Sure thing. Once I get Travis to pass, I'll remove the commit. In the meantime, I'll add a reminder to yours. |
1cf89fc
to
3c45f8b
Compare
deprecated_classes_in_future = ['Term', 'Panel'] | ||
|
||
# these should be removed from top-level namespace | ||
remove_classes_from_top_level_namespace = ['Expr'] | ||
|
||
# external modules exposed in pandas namespace | ||
modules = ['np', 'datetime', 'datetools'] | ||
modules = ['np', 'datetime', 'sys', 'warnings'] |
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 don't add
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.
Saying "don't add" doesn't help since I needed to add them to avoid test failures.
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 already told u this on the issue
you are polluting the namespace
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, but you provided no solution to not do it given my situation. Saying "don't do something" with no suggestion of a solution is not helpful whatsoever.
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 are writing the pr
I am telling you that this is wrong
that is helpful
it's up to you fix it
if you see later I do tell you how though
by using a separate module
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's not helpful because I don't know how to proceed with it. Sure, you did provide comments below that provide further guidance, but in isolation, "fixing it" is far from clear.
3c45f8b
to
7fa6429
Compare
8a845de
to
1a6e170
Compare
@jreback , @jorisvandenbossche : Travis is passing. Ready to merge if there are no other concerns. |
self.removals = removals | ||
|
||
def __getattr__(self, name): | ||
if name in dir(self.__class__): |
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.
set this on creation as this is a list so checking will be expensive (make it a set)
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.
Let's upgrade to a frozenset
. Done.
1a6e170
to
1cb7132
Compare
@jreback , @jorisvandenbossche : Travis is passing. Ready to merge if there are no other concerns. |
need to add
|
further I am not sure this actually works
something is wrong |
pls add some tests to verify the actual deprecations themselves (e.g. that you can import the previous things, or a sample of them) |
@jreback : Have you tried running |
@jreback : I don't want to overload |
@jreback : Don't fully understand your comments about testing. Aren't I doing that already? |
|
@gfyoung you can easily override |
@jreback : Ah, that's a fair point. I can just first check if it's in |
yep. The ideal thing is to replicate as much as possible the existing behavior (and just show a depreaction warning). |
1cb7132
to
2bb887d
Compare
@gfyoung The consequence of using a frozenset for the |
@jorisvandenbossche : That isn't a property What would you suggest I do then? |
I didn't want to imply it was a consequence of the 'frozen' aspect of the sets :-). But initially you used a list I think? And performance was the reason to change it to set? Simply using a list would keep the preferred order. |
@jorisvandenbossche : It was a general performance consideration that @jreback brought up. I originally used a While I do see your point about the imports and how they should come from specific places to be consistent with documentation, IMO the code is correct as is and shouldn't have to tailor to the namespace pollution that I pointed out. |
@gfyoung its a bit more work, but you can figure out where the imports are actually from, e.g. you can actually do the I actually did something like this (for some code I am working on which is old). I know where things are, and it still took some time / trial and error to figure out the correct imports :) not to mention the |
@jreback : |
I know it is not generic, but just using a list for |
Actually, can't we get the information from the object itself? (of course in this case where we want the full path it will give the right thing (frequencies or offsets), it will also not work generically for all imports where more top-level paths are used).
gives you that it should be 'offsets' and not frequencies |
@jorisvandenbossche : How do you extract the full class path from this? >>> getattr(pd.dateools, 'BDay')
<class 'pandas.tseries.offsets.BusinessDay'> Perhaps there's an obvious way, but I don't see one. If there isn't, then we might need to switch back to a @jreback : Thoughts? |
|
@jorisvandenbossche : That was indeed an obvious way. Completely escaped my mind. 😄 |
I am going to merge this, we can fix the actual depr warnings with correct modules in a follow-up PR, but then at least the deprecations are included in the rc |
Follow-up to pandas-devgh-14105. Uses the '__module__' method to correctly determine the location of the alternative module to use.
…eter * github.com:pydata/pandas: (554 commits) BUG: compat with Stata ver 111 Fix: F999 dictionary key '2000q4' repeated with different values (pandas-dev#14198) BLD: Test for Python 3.5 with C locale BUG: DatetimeTZBlock can't assign values near dst boundary BUG: union_categorical with Series and cat idx BUG: fix str.contains for series containing only nan values BUG: Categorical constructor not idempotent with ext dtype TST: Make encoded sep check more locale sensitive (pandas-dev#14161) DOC: minor typo in 0.19.0 whatsnew file (pandas-dev#14185) BUG: fix tz-aware datetime convert to DatetimeIndex (GH 14088) BUG : bug in setting a slice of a Series with a np.timedelta64 RLS: v0.19.0rc1 DOC: clean-up 0.19.0 whatsnew file (pandas-dev#14176) DOC: cleanup build warnings (pandas-dev#14172) Add steps to run gbq integration testing to the contributing docs (pandas-dev#14144) ENH: concat and append now can handle unordered categories (pandas-dev#13767) DEPR: Deprecate pandas.core.datetools (pandas-dev#14105) API/DEPR: Remove +/- as setops for DatetimeIndex/PeriodIndex (GH9630) (pandas-dev#14164) Fix trivial typo in comment (pandas-dev#14174) API/DEPR: Remove +/- as setops for Index (GH8227) (pandas-dev#14127) ...
* github.com:pydata/pandas: (554 commits) BUG: compat with Stata ver 111 Fix: F999 dictionary key '2000q4' repeated with different values (pandas-dev#14198) BLD: Test for Python 3.5 with C locale BUG: DatetimeTZBlock can't assign values near dst boundary BUG: union_categorical with Series and cat idx BUG: fix str.contains for series containing only nan values BUG: Categorical constructor not idempotent with ext dtype TST: Make encoded sep check more locale sensitive (pandas-dev#14161) DOC: minor typo in 0.19.0 whatsnew file (pandas-dev#14185) BUG: fix tz-aware datetime convert to DatetimeIndex (GH 14088) BUG : bug in setting a slice of a Series with a np.timedelta64 RLS: v0.19.0rc1 DOC: clean-up 0.19.0 whatsnew file (pandas-dev#14176) DOC: cleanup build warnings (pandas-dev#14172) Add steps to run gbq integration testing to the contributing docs (pandas-dev#14144) ENH: concat and append now can handle unordered categories (pandas-dev#13767) DEPR: Deprecate pandas.core.datetools (pandas-dev#14105) API/DEPR: Remove +/- as setops for DatetimeIndex/PeriodIndex (GH9630) (pandas-dev#14164) Fix trivial typo in comment (pandas-dev#14174) API/DEPR: Remove +/- as setops for Index (GH8227) (pandas-dev#14127) ...
Follow-up to gh-14105. Uses the '__module__' method to correctly determine the location of the alternative module to use.
Title is self-explanatory. Closes #14094.