Skip to content

Commit e4205af

Browse files
Merge pull request #6206 from jorisvandenbossche/docstring-numpydoc-cleanup
DOC: styling clean-up of docstrings (part 2: series and generic.py)
2 parents a2d5e53 + 244ca05 commit e4205af

File tree

2 files changed

+39
-31
lines changed

2 files changed

+39
-31
lines changed

pandas/core/generic.py

+23-18
Original file line numberDiff line numberDiff line change
@@ -809,8 +809,9 @@ def to_json(self, path_or_buf=None, orient=None, date_format='epoch',
809809
- columns : dict like {column -> {index -> value}}
810810
- values : just the values array
811811
812-
date_format : type of date conversion, epoch or iso
813-
epoch = epoch milliseconds, iso = ISO8601, default is epoch
812+
date_format : {'epoch', 'iso'}
813+
Type of date conversion. `epoch` = epoch milliseconds,
814+
`iso`` = ISO8601, default is epoch.
814815
double_precision : The number of decimal places to use when encoding
815816
floating point values, default 10.
816817
force_ascii : force encoded string to be ASCII, default True.
@@ -845,7 +846,8 @@ def to_hdf(self, path_or_buf, key, **kwargs):
845846
Parameters
846847
----------
847848
path_or_buf : the path (string) or buffer to put the store
848-
key : string, an indentifier for the group in the store
849+
key : string
850+
indentifier for the group in the store
849851
mode : optional, {'a', 'w', 'r', 'r+'}, default 'a'
850852
851853
``'r'``
@@ -2079,8 +2081,8 @@ def fillna(self, value=None, method=None, axis=0, inplace=False,
20792081
column (for a DataFrame). (values not in the dict/Series will not be
20802082
filled). This value cannot be a list.
20812083
axis : {0, 1}, default 0
2082-
0: fill column-by-column
2083-
1: fill row-by-row
2084+
* 0: fill column-by-column
2085+
* 1: fill row-by-row
20842086
inplace : boolean, default False
20852087
If True, fill in place. Note: this will modify any
20862088
other views on this object, (e.g. a no-copy slice for a column in a
@@ -2440,20 +2442,20 @@ def interpolate(self, method='linear', axis=0, limit=None, inplace=False,
24402442
'polynomial', 'spline' 'piecewise_polynomial', 'pchip'}
24412443
24422444
* 'linear': ignore the index and treat the values as equally
2443-
spaced. default
2445+
spaced. default
24442446
* 'time': interpolation works on daily and higher resolution
2445-
data to interpolate given length of interval
2447+
data to interpolate given length of interval
24462448
* 'index': use the actual numerical values of the index
24472449
* 'nearest', 'zero', 'slinear', 'quadratic', 'cubic',
24482450
'barycentric', 'polynomial' is passed to
24492451
`scipy.interpolate.interp1d` with the order given both
24502452
'polynomial' and 'spline' requre that you also specify and order
24512453
(int) e.g. df.interpolate(method='polynomial', order=4)
24522454
* 'krogh', 'piecewise_polynomial', 'spline', and 'pchip' are all
2453-
wrappers around the scipy interpolation methods of similar
2454-
names. See the scipy documentation for more on their behavior:
2455-
http://docs.scipy.org/doc/scipy/reference/interpolate.html#univariate-interpolation
2456-
http://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html
2455+
wrappers around the scipy interpolation methods of similar
2456+
names. See the scipy documentation for more on their behavior:
2457+
http://docs.scipy.org/doc/scipy/reference/interpolate.html#univariate-interpolation
2458+
http://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html
24572459
24582460
axis : {0, 1}, default 0
24592461
* 0: fill column-by-column
@@ -2745,20 +2747,23 @@ def resample(self, rule, how=None, axis=0, fill_method=None,
27452747
27462748
Parameters
27472749
----------
2748-
rule : the offset string or object representing target conversion
2749-
how : string, method for down- or re-sampling, default to 'mean' for
2750-
downsampling
2750+
rule : string
2751+
the offset string or object representing target conversion
2752+
how : string
2753+
method for down- or re-sampling, default to 'mean' for
2754+
downsampling
27512755
axis : int, optional, default 0
2752-
fill_method : string, fill_method for upsampling, default None
2756+
fill_method : string, default None
2757+
fill_method for upsampling
27532758
closed : {'right', 'left'}
27542759
Which side of bin interval is closed
27552760
label : {'right', 'left'}
27562761
Which bin edge label to label bucket with
27572762
convention : {'start', 'end', 's', 'e'}
2758-
kind: "period"/"timestamp"
2759-
loffset: timedelta
2763+
kind : "period"/"timestamp"
2764+
loffset : timedelta
27602765
Adjust the resampled time labels
2761-
limit: int, default None
2766+
limit : int, default None
27622767
Maximum size gap to when reindexing with fill_method
27632768
base : int, default 0
27642769
For frequencies that evenly subdivide 1 day, the "origin" of the

pandas/core/series.py

+16-13
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ class Series(generic.NDFrame):
9595

9696
"""
9797
One-dimensional ndarray with axis labels (including time series).
98+
9899
Labels need not be unique but must be any hashable type. The object
99100
supports both integer- and label-based indexing and provides a host of
100101
methods for performing operations involving the index. Statistical
@@ -117,7 +118,8 @@ class Series(generic.NDFrame):
117118
dict.
118119
dtype : numpy.dtype or None
119120
If None, dtype will be inferred
120-
copy : boolean, default False, copy input data
121+
copy : boolean, default False
122+
Copy input data
121123
"""
122124
_metadata = ['name']
123125

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

808810
def reset_index(self, level=None, drop=False, name=None, inplace=False):
809811
"""
810-
Analogous to the DataFrame.reset_index function, see docstring there.
812+
Analogous to the :meth:`pandas.DataFrame.reset_index` function, see
813+
docstring there.
811814
812815
Parameters
813816
----------
@@ -1133,7 +1136,7 @@ def value_counts(self, normalize=False, sort=True, ascending=False,
11331136
11341137
Parameters
11351138
----------
1136-
normalize: boolean, default False
1139+
normalize : boolean, default False
11371140
If True then the Series returned will contain the relative
11381141
frequencies of the unique values.
11391142
sort : boolean, default True
@@ -1161,7 +1164,7 @@ def mode(self):
11611164
Parameters
11621165
----------
11631166
sort : bool, default True
1164-
if True, will lexicographically sort values, if False skips
1167+
If True, will lexicographically sort values, if False skips
11651168
sorting. Result ordering when ``sort=False`` is not defined.
11661169
11671170
Returns
@@ -1398,9 +1401,9 @@ def corr(self, other, method='pearson',
13981401
----------
13991402
other : Series
14001403
method : {'pearson', 'kendall', 'spearman'}
1401-
pearson : standard correlation coefficient
1402-
kendall : Kendall Tau correlation coefficient
1403-
spearman : Spearman rank correlation
1404+
* pearson : standard correlation coefficient
1405+
* kendall : Kendall Tau correlation coefficient
1406+
* spearman : Spearman rank correlation
14041407
min_periods : int, optional
14051408
Minimum number of observations needed to have a valid result
14061409
@@ -1663,7 +1666,7 @@ def sort(self, axis=0, kind='quicksort', order=None, ascending=True):
16631666
16641667
See Also
16651668
--------
1666-
pandas.Series.order
1669+
Series.order
16671670
"""
16681671

16691672
# GH 5856/5863
@@ -1750,10 +1753,10 @@ def rank(self, method='average', na_option='keep', ascending=True):
17501753
Parameters
17511754
----------
17521755
method : {'average', 'min', 'max', 'first'}
1753-
average: average rank of group
1754-
min: lowest rank in group
1755-
max: highest rank in group
1756-
first: ranks assigned in order they appear in the array
1756+
* average: average rank of group
1757+
* min: lowest rank in group
1758+
* max: highest rank in group
1759+
* first: ranks assigned in order they appear in the array
17571760
na_option : {'keep'}
17581761
keep: leave NA values where they are
17591762
ascending : boolean, default True
@@ -2260,7 +2263,7 @@ def dropna(self, axis=0, inplace=False, **kwargs):
22602263
Returns
22612264
-------
22622265
valid : Series
2263-
inplace : bool (default False)
2266+
inplace : boolean, default False
22642267
Do operation in place.
22652268
"""
22662269
axis = self._get_axis_number(axis or 0)

0 commit comments

Comments
 (0)