Skip to content

DOC: Update the Period.day docstring #20294

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 2 commits into from
Mar 12, 2018

Conversation

IHackPy
Copy link
Contributor

@IHackPy IHackPy commented Mar 12, 2018

Period.day Docstring

################################################################################
######################## Docstring (pandas.Period.day) ########################
################################################################################

Return the number of days of particular month of a given Period.

This attribute returns the total number of days of given month on which
the particular date occurs.

Returns

Int
Number of days till particular date

See also

Period.dayofweek
Return the day of the week

Period.dayofyear
Return the day of the year

Examples

import pandas as pd
p = pd.Period("2018-03-11", freq='H')
p.day
11

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

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

@@ -1217,6 +1217,32 @@ cdef class _Period(object):

@property
def day(self):
"""
Return the number of days of particular month of a given Period.
Copy link
Member

Choose a reason for hiding this comment

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

This description would make me think this gives the number of days of the month the period falls in, i.e. if the month was February it would return 28. That's obviously note the case - can you think of a way to reword and make clearer?

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 I try to make this more clear I'm still thinking that summary is not good sense .
I have query : if we give any period like 2018-03-28 it return 28 so how i explain because I think it count all days till given date ?
If I think wrong correct me :)

Copy link
Member

Choose a reason for hiding this comment

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

I would say "Get day of the month that a Period falls on"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't find better sort explanation as you mention on above comment

"""
Return the number of days of particular month of a given Period.

This attribute returns the total number of days of given month on which
Copy link
Member

Choose a reason for hiding this comment

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

This is a pretty simple function so depending on how concise the short summary is might be OK to not have an extended summary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but I think when I remove extended summary validation_docstring.py gives error ???

Copy link
Member

Choose a reason for hiding this comment

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

You are right that the script would fail but I think this would pass as an exception


Returns
-------
Int
Copy link
Member

Choose a reason for hiding this comment

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

lowercase this

Returns
-------
Int
Number of days till particular date
Copy link
Member

Choose a reason for hiding this comment

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

This should be indented. Might want to reword based off of what you do with short summary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

still have confusion ?

Copy link
Member

Choose a reason for hiding this comment

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

Take a look at the contributing guide for the sprint. The very first example should show you how to format the Returns section

https://python-sprints.github.io/pandas/guide/pandas_docstring.html

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 write :
int
day of that month

Copy link
Contributor Author

Choose a reason for hiding this comment

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

or day of given month

Copy link
Member

Choose a reason for hiding this comment

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

Just write int here - this is simple enough that you don't need a description

For future reference though when you do put a description on the line below the type it needs to be indented (i.e. 4 spaces ahead of the line above)

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.dayofweek
Return the 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.

In this section the description should be on the same line as the referenced item separated by a " : "

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mean ===>>>>(Period.dayofweek: Return the 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.

Put a space before the colon and change the word "Return" to "Get" and yes you are correct


Examples
--------
>>> import pandas as pd
Copy link
Member

Choose a reason for hiding this comment

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

No need for import pandas as pd for any docstrings as it is implied (nor import numpy as np)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry my mistake

Int
Number of days till particular date

See also
Copy link
Member

Choose a reason for hiding this comment

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

Capitalize Also

@codecov
Copy link

codecov bot commented Mar 12, 2018

Codecov Report

Merging #20294 into master will increase coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #20294      +/-   ##
==========================================
+ Coverage    91.7%   91.73%   +0.02%     
==========================================
  Files         150      150              
  Lines       49168    49168              
==========================================
+ Hits        45090    45102      +12     
+ Misses       4078     4066      -12
Flag Coverage Δ
#multiple 90.11% <ø> (+0.02%) ⬆️
#single 41.86% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/plotting/_converter.py 66.81% <0%> (+1.73%) ⬆️

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 df2e361...85633a9. Read the comment docs.

@jorisvandenbossche jorisvandenbossche merged commit 75dfa21 into pandas-dev:master Mar 12, 2018
@jorisvandenbossche
Copy link
Member

@himanshuawasthi95 Thanks for the PR, and @WillAyd thanks for the review!

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

IHackPy commented Mar 12, 2018

Thanks @jorisvandenbossche and @WillAyd

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.

3 participants