Skip to content

DOC : Update the pandas.Period.hour docstring #20312

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

Merged
merged 3 commits into from
Mar 12, 2018

Conversation

IHackPy
Copy link
Contributor

@IHackPy IHackPy commented Mar 12, 2018

# Period.hour
################################################################################
######################## Docstring (pandas.Period.hour) ########################
################################################################################

Get hours of a day that a Period falls on.

Returns
-------
int

See Also
--------
Period.minute : Get the minute of hour
Period.second : Get the second of hour

Examples
--------
>>> p = pd.Period("2018-03-11 13:03:12.050000")
>>> p.hour
13

################################################################################
################################## Validation ##################################
################################################################################

@TomAugspurger TomAugspurger changed the title Doc : Update the Period.hour docstring DOC : Update the pandas.Period.hour docstring Mar 12, 2018
@@ -1241,6 +1241,24 @@ cdef class _Period(object):

@property
def hour(self):
"""
Get hours of a day that a Period falls on.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "Get the hour of the day component of a Period."? Since a Period can span multiple days.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup Period can span multiple days .Its really hard to define accurate sentance ... day conponent of the period sounds more clear.


Returns
-------
int
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the explanation note that it's betwene 0 and 23.

int
    The hour as an integer, between 0 and 23.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure


See Also
--------
Period.minute : Get the minute of hour
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"minute of hour" -> "minute of the Period." (end with a .).

See Also
--------
Period.minute : Get the minute of hour
Period.second : Get the second of hour
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"second of hour" -> "second of the Period." (end with a .).

>>> p = pd.Period("2018-03-11 13:03:12.050000")
>>> p.hour
13
"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add an example with a period longer than a day, to show that it uses 0?

In [4]: pd.Period("2017-01-01", freq="M").hour
Out[4]: 0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can I add this too

pd.Period("2017-01-01", freq="M").hour
0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please do (with the >>> like you've done for the other).

@TomAugspurger TomAugspurger merged commit 5e66789 into pandas-dev:master Mar 12, 2018
@TomAugspurger
Copy link
Contributor

Thanks @himanshuawasthi95 !

@TomAugspurger TomAugspurger added this to the 0.23.0 milestone Mar 12, 2018
@IHackPy
Copy link
Contributor Author

IHackPy commented Mar 13, 2018

thanks @TomAugspurger

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

Successfully merging this pull request may close these issues.

2 participants