Skip to content

DOC: update the Period.dayofweek attribute docstring #20280

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

Conversation

hammadmashkoor
Copy link
Contributor

@hammadmashkoor hammadmashkoor commented Mar 11, 2018

Checklist for the pandas documentation sprint (ignore this if you are doing
an unrelated PR):

  • PR title is "DOC: update the docstring"
  • The validation script passes: scripts/validate_docstrings.py <your-function-or-method>
  • The PEP8 style check passes: git diff upstream/master -u -- "*.py" | flake8 --diff
  • The html version looks good: python doc/make.py --single <your-function-or-method>
  • It has been proofread on language by another sprint participant

Please include the output of the validation script below between the "```" ticks:

(pandas_dev) root@kalih:~/pythonpanda/pandas# python scripts/validate_docstrings.py pandas.Period.dayofweek

################################################################################
##################### Docstring (pandas.Period.dayofweek)  #####################
################################################################################

Return the day of the week.

This attribute returns the day of the week on which the particular
starting date for the given period occurs with Monday=0, Sunday=6.

Returns
-------
Int
    Range of 0 to 6

See also
--------
Period.dayofyear
    Return the day of year.
Period.daysinmonth
    Return the days in that month.

Examples
--------
>>> period1 = pd.Period('2012-1-1 19:00', freq='H')
>>> period1
Period('2012-01-01 19:00', 'H')
>>> period1.dayofweek
6

>>> period2 = pd.Period('2013-1-9 11:00', freq='H')
>>> period2
Period('2013-01-09 11:00', 'H')
>>> period2.dayofweek
2

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

Docstring for "pandas.Period.dayofweek" correct. :)

If the validation script still gives errors, but you think there is a good reason
to deviate in this case (and there are certainly such cases), please state this
explicitly.

Copy link
Contributor

@dukebody dukebody left a comment

Choose a reason for hiding this comment

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

Can you fix the highlighted issues?

Return the day of the week.

This attribute returns the day of the week on which the particular
date occurs with Monady=0, Sunday=6.
Copy link
Contributor

Choose a reason for hiding this comment

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

Monday


Examples
--------
>>> p=pd.Period('2012-1-1 19:00', freq='H')
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Add spaces around p to follow flake8 also in docstrings.
  2. Perhaps better to use period for the variable name, it's short enough.

"""
Return the day of the week.

This attribute returns the day of the week on which the particular
Copy link
Contributor

Choose a reason for hiding this comment

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

If I'm not mistaken, this will return the day of the week on which the particular starting date for the given period occurs. I think this is important to mention, because at first I was confused thinking "how a period of one month can have a day of the week?".

Copy link
Member

Choose a reason for hiding this comment

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

Yes, we have this discussion in another PR as well (https://github.com/pandas-dev/pandas/pull/20277/files#r173651389). Only, it is not necessarily the starting date, it depends on the freq.

Copy link
Member

Choose a reason for hiding this comment

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

Issue is here: #20324.


Returns
-------
Int:Range of 0 to 6
Copy link
Contributor

Choose a reason for hiding this comment

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

@jreback jreback added the Period Period data type label Mar 11, 2018
Returns
-------
Int
Range of 0 to 6
Copy link
Contributor

Choose a reason for hiding this comment

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

  • I'd say correct English should be "Range from 0 to 6". So "from", not "of". But I'm not a native English speaker so please double check.
  • Perhaps add (included) to make clear 6 is also included. Since range(0, 6) in Python doesn't include the 6. :)
  • End line with period.

Returns
-------
Int
Range from 0 to 6(included).
Copy link
Member

Choose a reason for hiding this comment

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

space of 6

"""
Return the day of the week.

This attribute returns the day of the week on which the particular
Copy link
Member

Choose a reason for hiding this comment

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

Yes, we have this discussion in another PR as well (https://github.com/pandas-dev/pandas/pull/20277/files#r173651389). Only, it is not necessarily the starting date, it depends on the freq.

See also
--------
Period.dayofyear
Return the day of year.
Copy link
Member

Choose a reason for hiding this comment

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

Can you do this in form of Period.dayofyear : Return the day of year. ? (same for one below)

@codecov
Copy link

codecov bot commented Mar 13, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@fb556ed). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #20280   +/-   ##
=========================================
  Coverage          ?    91.7%           
=========================================
  Files             ?      150           
  Lines             ?    49168           
  Branches          ?        0           
=========================================
  Hits              ?    45090           
  Misses            ?     4078           
  Partials          ?        0
Flag Coverage Δ
#multiple 90.09% <ø> (?)
#single 41.86% <ø> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fb556ed...de15589. Read the comment docs.

@jorisvandenbossche jorisvandenbossche merged commit e995b0d into pandas-dev:master Mar 13, 2018
@jorisvandenbossche
Copy link
Member

@hammadmashkoor Thanks a lot!

@jorisvandenbossche jorisvandenbossche added this to the 0.23.0 milestone Mar 13, 2018
@hammadmashkoor
Copy link
Contributor Author

Thanks @jorisvandenbossche

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

Successfully merging this pull request may close these issues.

5 participants