-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
No WeekOfMonth Defined for Weekends #5115
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
Comments
@wesm Why is I found this code as well in frequencies:
|
Seems like for no good reason that I can think of. I'd be in favor of allowing it |
So the code now for inferring week of month is pretty broken. It does not work if the series spans a year boundary. range = pd.date_range('12/1/2000',periods=7,freq='WOM-1MON')
fi = pd.tseries.frequencies._FrequencyInferer(range)
fi._get_wom_rule() # yields None this is because (see code snippet above):
There are actually two bugs in this check:
|
CC @jtratner |
not sure how sensitive infer_freq should be. @wesm? |
For 1.:
|
can you check how that affects the performance of infer freq? I think there are some benchmarks in vbench too. If it's minimal then probably useful addition. |
I am thinking about the performance issue now. The fix for 1 should have minimal impact, but I will check. I have to think about 2. |
In fact the entire set based check (even with the additional three diffs) can be replaced with:
|
Which also avoids having to then perform: |
An example of the correctness issue:
which is clearly incorrect given that two of the dates are in October. |
The new code might actually be faster (simplistic test):
|
Seems promising! Can you run the vbench suite? |
and some other results:
|
this looks fine as far as vbenching |
I will fix as part of #5004
The text was updated successfully, but these errors were encountered: