Skip to content

Commit

Permalink
DOC: Fixes to docstring to add validation to CI (pandas-dev#23560)
Browse files Browse the repository at this point in the history
  • Loading branch information
datapythonista authored and Pingviinituutti committed Feb 28, 2019
1 parent 3b60fdf commit 8263352
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 28 deletions.
38 changes: 21 additions & 17 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -864,12 +864,17 @@ def iterrows(self):
data types, the iterator returns a copy and not a view, and writing
to it will have no effect.
Returns
-------
Yields
------
index : label or tuple of label
The index of the row. A tuple for a `MultiIndex`.
data : Series
The data of the row as a Series.
it : generator
A generator that iterates over the rows of the frame.
See also
See Also
--------
itertuples : Iterate over DataFrame rows as namedtuples of the values.
iteritems : Iterate over (column name, Series) pairs.
Expand Down Expand Up @@ -3951,6 +3956,10 @@ def set_index(self, keys, drop=True, append=False, inplace=False,
necessary. Setting to False will improve the performance of this
method
Returns
-------
DataFrame
Examples
--------
>>> df = pd.DataFrame({'month': [1, 4, 7, 10],
Expand Down Expand Up @@ -3991,10 +4000,6 @@ def set_index(self, keys, drop=True, append=False, inplace=False,
2 2014 4 40
3 2013 7 84
4 2014 10 31
Returns
-------
dataframe : DataFrame
"""
inplace = validate_bool_kwarg(inplace, 'inplace')
if not isinstance(keys, list):
Expand Down Expand Up @@ -6694,6 +6699,15 @@ def round(self, decimals=0, *args, **kwargs):
of `decimals` which are not columns of the input will be
ignored.
Returns
-------
DataFrame
See Also
--------
numpy.around
Series.round
Examples
--------
>>> df = pd.DataFrame(np.random.random([3, 3]),
Expand All @@ -6719,15 +6733,6 @@ def round(self, decimals=0, *args, **kwargs):
first 0.0 1 0.17
second 0.0 1 0.58
third 0.9 0 0.49
Returns
-------
DataFrame object
See Also
--------
numpy.around
Series.round
"""
from pandas.core.reshape.concat import concat

Expand Down Expand Up @@ -6793,7 +6798,6 @@ def corr(self, method='pearson', min_periods=1):
Examples
--------
>>> import numpy as np
>>> histogram_intersection = lambda a, b: np.minimum(a, b
... ).sum().round(decimals=1)
>>> df = pd.DataFrame([(.2, .3), (.0, .6), (.6, .0), (.2, .1)],
Expand Down
3 changes: 1 addition & 2 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -9691,8 +9691,7 @@ def nanptp(values, axis=0, skipna=True):

cls.ptp = _make_stat_function(
cls, 'ptp', name, name2, axis_descr,
"""
Returns the difference between the maximum value and the
"""Returns the difference between the maximum value and the
minimum value in the object. This is the equivalent of the
``numpy.ndarray`` method ``ptp``.
Expand Down
16 changes: 8 additions & 8 deletions pandas/core/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ def panel_index(time, panels, names=None):

class Panel(NDFrame):
"""
Represents wide format panel data, stored as 3-dimensional array
.. deprecated:: 0.20.0
The recommended way to represent 3-D data are with a MultiIndex on a
DataFrame via the :attr:`~Panel.to_frame()` method or with the
`xarray package <http://xarray.pydata.org/en/stable/>`__.
Pandas provides a :attr:`~Panel.to_xarray()` method to automate this
conversion.
Represents wide format panel data, stored as 3-dimensional array.
.. deprecated:: 0.20.0
The recommended way to represent 3-D data are with a MultiIndex on a
DataFrame via the :attr:`~Panel.to_frame()` method or with the
`xarray package <http://xarray.pydata.org/en/stable/>`__.
Pandas provides a :attr:`~Panel.to_xarray()` method to automate this
conversion.
Parameters
----------
Expand Down
1 change: 0 additions & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1913,7 +1913,6 @@ def corr(self, other, method='pearson', min_periods=None):
Examples
--------
>>> import numpy as np
>>> histogram_intersection = lambda a, b: np.minimum(a, b
... ).sum().round(decimals=1)
>>> s1 = pd.Series([.2, .0, .6, .2])
Expand Down

0 comments on commit 8263352

Please sign in to comment.