-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Spurious IncompatibleFrequency error prevented plotting of non-standard intervals (Fixes #14763) #14850
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
…tandard intervals (Fixes pandas-dev#14763)
…tandard intervals (Fixes pandas-dev#14763)
Current coverage is 85.26% (diff: 100%)@@ master #14850 diff @@
==========================================
Files 144 144
Lines 50979 50979
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 43468 43469 +1
+ Misses 7511 7510 -1
Partials 0 0
|
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.
Looks good to me!
Can you add
- a whatsnew notice in v0.20.0.txt in the bug fixes section?
- a test for
PeriodIndex(array of Periods)
with different but compatible freqs
cc @sinhrks
@@ -802,6 +802,11 @@ def test_custom_business_day_freq(self): | |||
|
|||
_check_plot_works(s.plot) | |||
|
|||
def test_non_standard_intervals(self): | |||
idx = pd.period_range('2000-01-01', '2000-01-05', freq='6H') |
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.
Can you add the github issue number as a comment?
pls also add a whatsnew entry (0.20.0) is fine. |
@jorisvandenbossche @jreback @sinhrks After doing some more testing I don't think the fix I've made here is the correct one, so I am going to close this pull request for now. What I submitted does result in the desired plots but I believe it also breaks some behavior in PeriodIndex. The right way to do this is a good deal more complicated than I originally thought, and I don't think I am the right one to do it given my relative inexperience working with this codebase. Happy to discuss my findings if anyone else wants to try to solve this. Example of an undesired side effect of the fix:
As you can see, you get a PeriodIndex which says its freq is 6H, but some of the points have a 5H difference. In the current master this code would just result in a plain ndarray. |
git diff upstream/master | flake8 --diff
Fix Summary: A check on frequency compatibility was unnecessarily strict. Now IncompatibleFrequency exceptions will only get raised if the unit types differ.