Skip to content
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

Fix PR10 error and Clean up docstrings from functions related to RT05 errors #25132

Merged
merged 34 commits into from
Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
2c4455c
Fix validation error RT05
thoo Feb 4, 2019
c87102f
Fix pep8
thoo Feb 4, 2019
d552569
Merge remote-tracking branch 'upstream/master' into Rt05
thoo Feb 4, 2019
03aaa92
fix merge conflict
thoo Feb 4, 2019
36a610a
fix RT04
thoo Feb 4, 2019
c2e24b3
fix as recommended
thoo Feb 5, 2019
f5cfc8a
Merge remote-tracking branch 'upstream/master' into Rt05
thoo Feb 5, 2019
6e658f8
fix bullets
thoo Feb 5, 2019
5304b9c
fix upon suggestions
thoo Feb 6, 2019
7601aed
fix upon suggestions
thoo Feb 6, 2019
128dadb
fix failing tests
thoo Feb 6, 2019
3d3e408
replace with bullet
thoo Feb 6, 2019
522e76d
typo
thoo Feb 6, 2019
163e9e3
Retrigger :pandas-dev conda 27 failed
thoo Feb 6, 2019
b55b270
Merge remote-tracking branch 'upstream/master' into Rt05
thoo Feb 7, 2019
ba4f001
Merge remote-tracking branch 'upstream/master' into Rt05
thoo Feb 8, 2019
25e7503
update code_checks.sh
thoo Feb 8, 2019
1824b99
Merge remote-tracking branch 'upstream/master' into Rt05
thoo Feb 11, 2019
1262632
Merge remote-tracking branch 'upstream/master' into Rt05
thoo Feb 16, 2019
e12ee2a
fix as recommended
thoo Feb 16, 2019
bfe30f8
fix some leftover
thoo Feb 16, 2019
d5d270b
Retrigger :pandas-devs failed
thoo Feb 17, 2019
6ac909b
Retrigger :pandas-devs failed second time
thoo Feb 17, 2019
4e4f24a
Retrigger :pandas-devs failed second time
thoo Feb 17, 2019
283861f
Merge remote-tracking branch 'upstream/master' into Rt05
thoo Feb 17, 2019
953159c
fix at Series.unique
thoo Feb 20, 2019
15fde16
Merge remote-tracking branch 'upstream/master' into Rt05
thoo Feb 20, 2019
94e5279
add PR10
thoo Feb 21, 2019
39ab010
drop PR10
thoo Feb 21, 2019
64bd51b
fix PR10 error
thoo Feb 21, 2019
7051e3c
fix as recommended
thoo Feb 22, 2019
a35f869
Merge remote-tracking branch 'upstream/master' into Rt05
thoo Feb 22, 2019
b847e4e
fix as recommended
thoo Feb 22, 2019
2d62018
Merge remote-tracking branch 'upstream/master' into Rt05
thoo Feb 28, 2019
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
4 changes: 2 additions & 2 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ fi
### DOCSTRINGS ###
if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then

MSG='Validate docstrings (GL06, GL07, GL09, SS04, PR03, PR05, EX04, RT04)' ; echo $MSG
$BASE_DIR/scripts/validate_docstrings.py --format=azure --errors=GL06,GL07,GL09,SS04,PR03,PR05,EX04,RT04
MSG='Validate docstrings (GL06, GL07, GL09, SS04, PR03, PR05, EX04, RT04, RT05)' ; echo $MSG
$BASE_DIR/scripts/validate_docstrings.py --format=azure --errors=GL06,GL07,GL09,SS04,PR03,PR05,EX04,RT04,RT05
RET=$(($RET + $?)) ; echo $MSG "DONE"

fi
Expand Down
7 changes: 4 additions & 3 deletions pandas/core/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,10 @@ def unique(values):
Returns
-------
unique values.
thoo marked this conversation as resolved.
Show resolved Hide resolved
If the input is an Index, the return is an Index
If the input is a Categorical dtype, the return is a Categorical
If the input is a Series/ndarray, the return will be an ndarray
The return can be:
- If the input is an Index, the return is an Index.
- If the input is a Categorical dtype, the return is a Categorical.
- If the input is a Series/ndarray, the return will be an ndarray.
Copy link
Member

Choose a reason for hiding this comment

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

Same comment here around periods for bullet points


See Also
--------
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/arrays/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@ def __array__(self, dtype=None):
values : numpy array
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
values : numpy array
numpy.array

A numpy array of either the specified dtype or,
if dtype==None (default), the same dtype as
categorical.categories.dtype
categorical.categories.dtype .
thoo marked this conversation as resolved.
Show resolved Hide resolved
"""
ret = take_1d(self.categories.values, self._codes)
if dtype and not is_dtype_equal(dtype, self.categories.dtype):
Expand Down Expand Up @@ -1501,7 +1501,7 @@ def get_values(self):
-------
values : numpy array
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
values : numpy array
numpy.array

A numpy array of the same dtype as categorical.categories.dtype or
Index if datetime / periods
Index if datetime / periods.
"""
# if we are a datetime and period index, return Index to keep metadata
if is_datetimelike(self.categories):
Expand Down
8 changes: 4 additions & 4 deletions pandas/core/arrays/datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def strftime(self, date_format):
Return an Index of formatted strings specified by date_format, which
supports the same string format as the python standard library. Details
of the string format can be found in `python string format
doc <%(URL)s>`__
doc <%(URL)s>`__ .
thoo marked this conversation as resolved.
Show resolved Hide resolved

Parameters
----------
Expand All @@ -154,7 +154,7 @@ def strftime(self, date_format):
Returns
-------
Index
Index of formatted strings
Index of formatted strings.

See Also
--------
Expand Down Expand Up @@ -748,7 +748,7 @@ def _maybe_mask_results(self, result, fill_value=iNaT, convert=None):
mask the result if needed, convert to the provided dtype if its not
None

This is an internal routine
This is an internal routine.
"""

if self._hasnans:
Expand Down Expand Up @@ -1047,7 +1047,7 @@ def _sub_period_array(self, other):
Returns
-------
result : np.ndarray[object]
Array of DateOffset objects; nulls represented by NaT
Array of DateOffset objects; nulls represented by NaT.
"""
if not is_period_dtype(self):
raise TypeError("cannot subtract {dtype}-dtype from {cls}"
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -2797,7 +2797,7 @@ def set_value(self, index, col, value, takeable=False):
-------
frame : DataFrame
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
frame : DataFrame
DataFrame

If label pair is contained, will be reference to calling DataFrame,
otherwise a new object
otherwise a new object.
"""
warnings.warn("set_value is deprecated and will be removed "
"in a future release. Please use "
Expand Down
22 changes: 12 additions & 10 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4951,10 +4951,12 @@ def pipe(self, func, *args, **kwargs):
Returns
-------
DataFrame, Series or scalar
If DataFrame.agg is called with a single function, returns a Series
If DataFrame.agg is called with several functions, returns a DataFrame
If Series.agg is called with single function, returns a scalar
If Series.agg is called with several functions, returns a Series
The return can be:
- If DataFrame.agg is called with a single function, returns a Series.
thoo marked this conversation as resolved.
Show resolved Hide resolved
- If DataFrame.agg is called with several functions, returns
a DataFrame.
- If Series.agg is called with single function, returns a scalar.
- If Series.agg is called with several functions, returns a Series.
Copy link
Member

Choose a reason for hiding this comment

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

Let's do the same thing you are doing below, where instead of putting periods at the end of each bullet you end with a short sentence after the bullets


%(see_also)s

Expand Down Expand Up @@ -5350,7 +5352,7 @@ def get_values(self):
Returns
-------
numpy.ndarray
Numpy representation of DataFrame
Numpy representation of DataFrame.

See Also
--------
Expand Down Expand Up @@ -5429,7 +5431,7 @@ def get_ftype_counts(self):
-------
dtype : Series
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
dtype : Series
Series

Series with the count of columns with each type and
sparsity (dense/sparse)
sparsity (dense/sparse).

See Also
--------
Expand Down Expand Up @@ -6658,7 +6660,7 @@ def replace(self, to_replace=None, value=None, inplace=False, limit=None,
-------
Series or DataFrame
Returns the same object type as the caller, interpolated at
some or all ``NaN`` values
some or all ``NaN`` values.

See Also
--------
Expand Down Expand Up @@ -6882,7 +6884,7 @@ def asof(self, where, subset=None):
Series: when `self` is a Series and `where` is an array-like,
or when `self` is a DataFrame and `where` is a scalar
DataFrame : when `self` is a DataFrame and `where` is an
array-like
array-like.
Copy link
Member

Choose a reason for hiding this comment

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

same about making a list


See Also
--------
Expand Down Expand Up @@ -7236,7 +7238,7 @@ def clip(self, lower=None, upper=None, axis=None, inplace=False,
-------
Series or DataFrame
Same type as calling object with the values outside the
clip boundaries replaced
clip boundaries replaced.

Examples
--------
Expand Down Expand Up @@ -8387,7 +8389,7 @@ def ranker(data):
Returns
-------
(left, right) : (%(klass)s, type of other)
Aligned objects
Aligned objects.
""")

@Appender(_shared_docs['align'] % _shared_doc_kwargs)
Expand Down
22 changes: 11 additions & 11 deletions pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1556,11 +1556,11 @@ def droplevel(self, level=0):
Returns
-------
grouper : Index
Index of values to group on
Index of values to group on.
labels : ndarray of int or None
Array of locations in level_index
Array of locations in level_index.
uniques : Index or None
Index of unique values for level
Index of unique values for level.
"""

@Appender(_index_shared_docs['_get_grouper_for_level'])
Expand Down Expand Up @@ -1828,7 +1828,7 @@ def isna(self):
Returns
-------
numpy.ndarray
A boolean array of whether my values are NA
A boolean array of whether my values are NA.

See Also
--------
Expand Down Expand Up @@ -2972,7 +2972,7 @@ def _convert_listlike_indexer(self, keyarr, kind=None):
-------
tuple (indexer, keyarr)
Copy link
Member

Choose a reason for hiding this comment

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

do you mind having two return params instead

indexer is an ndarray or None if cannot convert
keyarr are tuple-safe keys
keyarr are tuple-safe keys.
Copy link
Member

Choose a reason for hiding this comment

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

do you mind documenting both parameters separately? It's done in other parts of this PR

"""
if isinstance(keyarr, Index):
keyarr = self._convert_index_indexer(keyarr)
Expand Down Expand Up @@ -3098,9 +3098,9 @@ def reindex(self, target, method=None, level=None, limit=None,
Returns
-------
new_index : pd.Index
Resulting index
Resulting index.
indexer : np.ndarray or None
Indices of output values in original index
Indices of output values in original index.

"""
# GH6552: preserve names when reindexing to non-named target
Expand Down Expand Up @@ -3156,9 +3156,9 @@ def _reindex_non_unique(self, target):
Returns
-------
new_index : pd.Index
Resulting index
Resulting index.
indexer : np.ndarray or None
Indices of output values in original index
Indices of output values in original index.

"""

Expand Down Expand Up @@ -4259,7 +4259,7 @@ def shift(self, periods=1, freq=None):
Returns
-------
pandas.Index
Shifted index
Shifted index.

See Also
--------
Expand Down Expand Up @@ -4422,7 +4422,7 @@ def set_value(self, arr, key, value):
in the target are marked by -1.
missing : ndarray of int
An indexer into the target of the values not found.
These correspond to the -1 in the indexer array
These correspond to the -1 in the indexer array.
"""

@Appender(_index_shared_docs['get_indexer_non_unique'] % _index_doc_kwargs)
Expand Down
12 changes: 6 additions & 6 deletions pandas/core/indexes/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def _codes_to_ints(self, codes):
Returns
------
int_keys : scalar or 1-dimensional array, of dtype uint64
Integer(s) representing one combination (each)
Integer(s) representing one combination (each).
"""
# Shift the representation of each level by the pre-calculated number
# of bits:
Expand Down Expand Up @@ -101,7 +101,7 @@ def _codes_to_ints(self, codes):
Returns
------
int_keys : int, or 1-dimensional array of dtype object
Integer(s) representing one combination (each)
Integer(s) representing one combination (each).
"""

# Shift the representation of each level by the pre-calculated number
Expand Down Expand Up @@ -1956,7 +1956,7 @@ def swaplevel(self, i=-2, j=-1):
Returns
-------
MultiIndex
A new MultiIndex
A new MultiIndex.

.. versionchanged:: 0.18.1

Expand Down Expand Up @@ -2053,9 +2053,9 @@ def sortlevel(self, level=0, ascending=True, sort_remaining=True):
Returns
-------
sorted_index : pd.MultiIndex
Resulting index
Resulting index.
indexer : np.ndarray
Indices of output values in original index
Indices of output values in original index.
"""
from pandas.core.sorting import indexer_from_factorized

Expand Down Expand Up @@ -2189,7 +2189,7 @@ def reindex(self, target, method=None, level=None, limit=None,
new_index : pd.MultiIndex
Resulting index
indexer : np.ndarray or None
Indices of output values in original index
Indices of output values in original index.

"""
# GH6552: preserve names when reindexing to non-named target
Expand Down
6 changes: 3 additions & 3 deletions pandas/core/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def set_value(self, *args, **kwargs):
-------
panel : Panel
If label combo is contained, will be reference to calling Panel,
otherwise a new object
otherwise a new object.
"""
warnings.warn("set_value is deprecated and will be removed "
"in a future release. Please use "
Expand Down Expand Up @@ -802,7 +802,7 @@ def major_xs(self, key):
Returns
-------
y : DataFrame
Index -> minor axis, columns -> items
Index -> minor axis, columns -> items.

Notes
-----
Expand All @@ -826,7 +826,7 @@ def minor_xs(self, key):
Returns
-------
y : DataFrame
Index -> major axis, columns -> items
Index -> major axis, columns -> items.

Notes
-----
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/reshape/melt.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def wide_to_long(df, stubnames, i, j, sep="", suffix=r'\d+'):
-------
DataFrame
A DataFrame that contains each stub name as a variable, with new index
(i, j)
(i, j).

Notes
-----
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ def set_value(self, label, value, takeable=False):
-------
series : Series
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
series : Series
Series

If label is contained, will be reference to calling Series,
otherwise a new object
otherwise a new object.
"""
warnings.warn("set_value is deprecated and will be removed "
"in a future release. Please use "
Expand Down Expand Up @@ -1629,7 +1629,7 @@ def unique(self):
* Datetime with Timezone
* Interval
* Sparse
* IntegerNA
* IntegerNA .
Copy link
Member

Choose a reason for hiding this comment

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

not sure what we should do here, I understand what you did, and may be it's the best for now, but looks a bit wierd

Copy link
Member

Choose a reason for hiding this comment

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

I've seen this on quite a few other requests. Nuanced but I'm personally of the opinion that this is a "hack" to pass validation so would prefer another route. Can you just add a one-line description after the bullet points instead?


See Also
--------
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/tools/numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def to_numeric(arg, errors='raise', downcast=None):
Returns
-------
ret : numeric if parsing succeeded.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ret : numeric if parsing succeeded.
int or float

Return type depends on input. Series if Series, otherwise ndarray
Return type depends on input. Series if Series, otherwise ndarray.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Return type depends on input. Series if Series, otherwise ndarray.
Return type depends on input. Series if Series, otherwise ndarray.


See Also
--------
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,7 @@ def skew(self, **kwargs):
-------
Series or DataFrame
Returned object type is determined by the caller of the %(name)s
calculation
calculation.

See Also
--------
Expand Down
2 changes: 1 addition & 1 deletion pandas/io/formats/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ def render(self, **kwargs):
Returns
-------
rendered : str
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
rendered : str
str

The rendered HTML
The rendered HTML.

Notes
-----
Expand Down
Loading