-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Why does infer_freq
raise an error for PeriodIndex?
#6771
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
Ah, well that was before I realized that Multiple periods in a PeriodIndex? Doesn't that defeat the whole purpose? |
the issue is that if you have a list of periods and you want to construct a Periodindex then in theory you should infer a new freq (eg say u string together 4 month periods that are quarterly) I think this is pretty ambiguous and that is the issue (while time stamps can be too it is less so) that said u can simply make sure that all the periods are the same freq and just return it |
I see. I never even thought of this. I always assume that PeriodIndex is an index of consecutive (missing values allowed) Period types with the frequency correctly defined i.e., you never get monthly periods to represent a quarterly index. If we're given a PeriodIndex of monthly Periods that are supposed to be quarterly, then we (statsmodels) are going to incorrectly extrapolate out of sample. The ambiguity is that it's not clear whether you should return monthly or quarterly? I'd argue to return quarterly. The use case being, I want to extrapolate out of sample. The offset should be (inferred to be) quarterly not monthly. It makes sense to me not to allow a difference between frequency and offset in |
xref #8466
Can't it just return the
freq
for you instead of raising an error? Helps with duck typing.Error message
The text was updated successfully, but these errors were encountered: