Skip to content

DOC: styling clean-up of docstrings (part 2: series and generic.py) #6206

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 23 additions & 18 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,8 +809,9 @@ def to_json(self, path_or_buf=None, orient=None, date_format='epoch',
- columns : dict like {column -> {index -> value}}
- values : just the values array

date_format : type of date conversion, epoch or iso
epoch = epoch milliseconds, iso = ISO8601, default is epoch
date_format : {'epoch', 'iso'}
Type of date conversion. `epoch` = epoch milliseconds,
`iso`` = ISO8601, default is epoch.
double_precision : The number of decimal places to use when encoding
floating point values, default 10.
force_ascii : force encoded string to be ASCII, default True.
Expand Down Expand Up @@ -845,7 +846,8 @@ def to_hdf(self, path_or_buf, key, **kwargs):
Parameters
----------
path_or_buf : the path (string) or buffer to put the store
key : string, an indentifier for the group in the store
key : string
indentifier for the group in the store
mode : optional, {'a', 'w', 'r', 'r+'}, default 'a'

``'r'``
Expand Down Expand Up @@ -2079,8 +2081,8 @@ def fillna(self, value=None, method=None, axis=0, inplace=False,
column (for a DataFrame). (values not in the dict/Series will not be
filled). This value cannot be a list.
axis : {0, 1}, default 0
0: fill column-by-column
1: fill row-by-row
* 0: fill column-by-column
* 1: fill row-by-row
inplace : boolean, default False
If True, fill in place. Note: this will modify any
other views on this object, (e.g. a no-copy slice for a column in a
Expand Down Expand Up @@ -2440,20 +2442,20 @@ def interpolate(self, method='linear', axis=0, limit=None, inplace=False,
'polynomial', 'spline' 'piecewise_polynomial', 'pchip'}

* 'linear': ignore the index and treat the values as equally
spaced. default
spaced. default
* 'time': interpolation works on daily and higher resolution
data to interpolate given length of interval
data to interpolate given length of interval
* 'index': use the actual numerical values of the index
* 'nearest', 'zero', 'slinear', 'quadratic', 'cubic',
'barycentric', 'polynomial' is passed to
`scipy.interpolate.interp1d` with the order given both
'polynomial' and 'spline' requre that you also specify and order
(int) e.g. df.interpolate(method='polynomial', order=4)
* 'krogh', 'piecewise_polynomial', 'spline', and 'pchip' are all
wrappers around the scipy interpolation methods of similar
names. See the scipy documentation for more on their behavior:
http://docs.scipy.org/doc/scipy/reference/interpolate.html#univariate-interpolation
http://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html
wrappers around the scipy interpolation methods of similar
names. See the scipy documentation for more on their behavior:
http://docs.scipy.org/doc/scipy/reference/interpolate.html#univariate-interpolation
http://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html

axis : {0, 1}, default 0
* 0: fill column-by-column
Expand Down Expand Up @@ -2745,20 +2747,23 @@ def resample(self, rule, how=None, axis=0, fill_method=None,

Parameters
----------
rule : the offset string or object representing target conversion
how : string, method for down- or re-sampling, default to 'mean' for
downsampling
rule : string
the offset string or object representing target conversion
how : string
method for down- or re-sampling, default to 'mean' for
downsampling
axis : int, optional, default 0
fill_method : string, fill_method for upsampling, default None
fill_method : string, default None
fill_method for upsampling
closed : {'right', 'left'}
Which side of bin interval is closed
label : {'right', 'left'}
Which bin edge label to label bucket with
convention : {'start', 'end', 's', 'e'}
kind: "period"/"timestamp"
loffset: timedelta
kind : "period"/"timestamp"
loffset : timedelta
Adjust the resampled time labels
limit: int, default None
limit : int, default None
Maximum size gap to when reindexing with fill_method
base : int, default 0
For frequencies that evenly subdivide 1 day, the "origin" of the
Expand Down
29 changes: 16 additions & 13 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class Series(generic.NDFrame):

"""
One-dimensional ndarray with axis labels (including time series).

Labels need not be unique but must be any hashable type. The object
supports both integer- and label-based indexing and provides a host of
methods for performing operations involving the index. Statistical
Expand All @@ -117,7 +118,8 @@ class Series(generic.NDFrame):
dict.
dtype : numpy.dtype or None
If None, dtype will be inferred
copy : boolean, default False, copy input data
copy : boolean, default False
Copy input data
"""
_metadata = ['name']

Expand Down Expand Up @@ -807,7 +809,8 @@ def set_value(self, label, value):

def reset_index(self, level=None, drop=False, name=None, inplace=False):
"""
Analogous to the DataFrame.reset_index function, see docstring there.
Analogous to the :meth:`pandas.DataFrame.reset_index` function, see
docstring there.

Parameters
----------
Expand Down Expand Up @@ -1133,7 +1136,7 @@ def value_counts(self, normalize=False, sort=True, ascending=False,

Parameters
----------
normalize: boolean, default False
normalize : boolean, default False
If True then the Series returned will contain the relative
frequencies of the unique values.
sort : boolean, default True
Expand Down Expand Up @@ -1161,7 +1164,7 @@ def mode(self):
Parameters
----------
sort : bool, default True
if True, will lexicographically sort values, if False skips
If True, will lexicographically sort values, if False skips
sorting. Result ordering when ``sort=False`` is not defined.

Returns
Expand Down Expand Up @@ -1398,9 +1401,9 @@ def corr(self, other, method='pearson',
----------
other : Series
method : {'pearson', 'kendall', 'spearman'}
pearson : standard correlation coefficient
kendall : Kendall Tau correlation coefficient
spearman : Spearman rank correlation
* pearson : standard correlation coefficient
* kendall : Kendall Tau correlation coefficient
* spearman : Spearman rank correlation
min_periods : int, optional
Minimum number of observations needed to have a valid result

Expand Down Expand Up @@ -1663,7 +1666,7 @@ def sort(self, axis=0, kind='quicksort', order=None, ascending=True):

See Also
--------
pandas.Series.order
Series.order
"""

# GH 5856/5863
Expand Down Expand Up @@ -1750,10 +1753,10 @@ def rank(self, method='average', na_option='keep', ascending=True):
Parameters
----------
method : {'average', 'min', 'max', 'first'}
average: average rank of group
min: lowest rank in group
max: highest rank in group
first: ranks assigned in order they appear in the array
* average: average rank of group
* min: lowest rank in group
* max: highest rank in group
* first: ranks assigned in order they appear in the array
na_option : {'keep'}
keep: leave NA values where they are
ascending : boolean, default True
Expand Down Expand Up @@ -2260,7 +2263,7 @@ def dropna(self, axis=0, inplace=False, **kwargs):
Returns
-------
valid : Series
inplace : bool (default False)
inplace : boolean, default False
Do operation in place.
"""
axis = self._get_axis_number(axis or 0)
Expand Down