Skip to content
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

high-freq properties of low-freq Periods #18378

Open
jbrockmendel opened this issue Nov 20, 2017 · 2 comments
Open

high-freq properties of low-freq Periods #18378

jbrockmendel opened this issue Nov 20, 2017 · 2 comments
Labels
Bug Period Period data type

Comments

@jbrockmendel
Copy link
Member

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.

@gfyoung gfyoung added API Design Period Period data type labels Nov 20, 2017
@WillAyd
Copy link
Member

WillAyd commented Nov 24, 2017

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

@jbrockmendel
Copy link
Member Author

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Period Period data type
Projects
None yet
Development

No branches or pull requests

4 participants