Skip to content

DOC: Update the examples to DataFrame.mod docstring #20406

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 8 commits into from
Jul 10, 2018

Conversation

ailchau
Copy link
Contributor

@ailchau ailchau commented Mar 19, 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:

################################################################################
####################### Docstring (pandas.DataFrame.mod) #######################
################################################################################

Modulo of dataframe and other, element-wise (binary operator `mod`).

Equivalent to ``dataframe % other``, but with support to substitute a fill_value for
missing data in one of the inputs.

Parameters
----------
other : Series, DataFrame, or constant
axis : {0, 1, 'index', 'columns'}
    For Series input, axis to match Series index on
level : int or name
    Broadcast across a level, matching Index values on the
    passed MultiIndex level
fill_value : None or float value, default None
    Fill existing missing (NaN) values, and any new element needed for
    successful DataFrame alignment, with this value before computation.
    If data in both corresponding DataFrame locations is missing
    the result will be missing

Notes
-----
Mismatched indices will be unioned together

Returns
-------
result : DataFrame

Examples
--------

>>> a = pd.DataFrame([2, 4, np.nan, 6.2], index=["a","b","c","d"],
...                  columns=['one'])
>>> a
    one
a   2.0
b   4.0
c   NaN
d   6.2
>>> a.mod(3, fill_value=-1)
    one
a   2.0
b   1.0
c   2.0
d   0.2
>>> b = pd.DataFrame(dict(one=[np.nan, 2, 3, 14], two=[np.nan, 1, 1, 3]),
...                  index=['a', 'b', 'c', 'd'])
>>> b
    one   two
a   NaN   NaN
b   2.0   1.0
c   3.0   1.0
d   14.0  3.0
>>> c = pd.DataFrame(dict(one=[np.nan, np.nan, 6, np.nan],
...                       three=[np.nan, 10, np.nan, -7]),
...                  index=['a', 'b', 'd', 'e'])
>>> c
    one three
a   NaN NaN
b   NaN 10.0
d   6.0 NaN
e   NaN -7.0
>>> b.mod(c, fill_value=3)
    one   three two
a   NaN   NaN   NaN
b   2.0   3.0   1.0
c   0.0   NaN   1.0
d   2.0   NaN   0.0
e   NaN  -4.0   NaN


See also
--------
DataFrame.rmod

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

Errors found:
	Use only one blank line to separate sections or paragraphs
	Errors in parameters section
		Parameter "other" has no description
		Parameter "axis" description should finish with "."
		Parameter "level" description should finish with "."
		Parameter "fill_value" description should finish with "."
	Missing description for See Also "DataFrame.rmod" reference

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.

I only added the examples. These errors were present before I added the examples.

@codecov
Copy link

codecov bot commented Mar 19, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@44691ee). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #20406   +/-   ##
=========================================
  Coverage          ?   91.92%           
=========================================
  Files             ?      160           
  Lines             ?    49915           
  Branches          ?        0           
=========================================
  Hits              ?    45884           
  Misses            ?     4031           
  Partials          ?        0
Flag Coverage Δ
#multiple 90.3% <100%> (?)
#single 42.1% <100%> (?)
Impacted Files Coverage Δ
pandas/core/ops.py 96.47% <100%> (ø)

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 44691ee...5b21867. Read the comment docs.

@WillAyd WillAyd merged commit c5870aa into pandas-dev:master Jul 10, 2018
@WillAyd
Copy link
Member

WillAyd commented Jul 10, 2018

Thanks @ailchau !

Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this pull request Oct 1, 2018
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.

4 participants