I find the following counter-intuitive:
>>> per = pd.Period('2016')
>>> per
Period('2016', 'A-DEC')
>>> (per.month, per.day, per.hour)
(12, 31, 0)
Since this Period represents the span from Jan1-Dec 31, it seems that month, day, hour, etc are not meaningful, should be NaN.
Comment From: WillAyd
One thing we might be able to do here is leverage the _period_code_map
in frequencies.pyx and check within the Period
properties if the instance's freq
is at a more granular level of information than the property being access. If so return the property, otherwise NaN
Comment From: jbrockmendel
@WillAyd that sounds like a reasonable approach to the implementation. For now the goal is just to get consensus that the API change is desirable. @gfyoung thoughts?
Comment From: jbrockmendel
8 years and i haven't seen anyone complain about this behavior as pain point. Changing it to return NaN would break type-safety and hurt perf. Closing.