Skip to content

Commit 0a61ecd

Browse files
thooWillAyd
authored andcommitted
Fix PR10 error and Clean up docstrings from functions related to RT05 errors (#25132)
1 parent db978c7 commit 0a61ecd

File tree

13 files changed

+118
-95
lines changed

13 files changed

+118
-95
lines changed

ci/code_checks.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ fi
241241
### DOCSTRINGS ###
242242
if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
243243

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

248248
fi

pandas/core/algorithms.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,15 @@ def unique(values):
288288
289289
Returns
290290
-------
291-
unique values.
292-
If the input is an Index, the return is an Index
293-
If the input is a Categorical dtype, the return is a Categorical
294-
If the input is a Series/ndarray, the return will be an ndarray.
291+
numpy.ndarray or ExtensionArray
292+
293+
The return can be:
294+
295+
* Index : when the input is an Index
296+
* Categorical : when the input is a Categorical dtype
297+
* ndarray : when the input is a Series/ndarray
298+
299+
Return numpy.ndarray or ExtensionArray.
295300
296301
See Also
297302
--------

pandas/core/arrays/categorical.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,7 @@ def __array__(self, dtype=None):
12891289
12901290
Returns
12911291
-------
1292-
values : numpy array
1292+
numpy.array
12931293
A numpy array of either the specified dtype or,
12941294
if dtype==None (default), the same dtype as
12951295
categorical.categories.dtype.
@@ -1499,9 +1499,9 @@ def get_values(self):
14991499
15001500
Returns
15011501
-------
1502-
values : numpy array
1502+
numpy.array
15031503
A numpy array of the same dtype as categorical.categories.dtype or
1504-
Index if datetime / periods
1504+
Index if datetime / periods.
15051505
"""
15061506
# if we are a datetime and period index, return Index to keep metadata
15071507
if is_datetimelike(self.categories):
@@ -1540,7 +1540,7 @@ def argsort(self, *args, **kwargs):
15401540
15411541
Returns
15421542
-------
1543-
argsorted : numpy array
1543+
numpy.array
15441544
15451545
See Also
15461546
--------
@@ -1593,7 +1593,7 @@ def sort_values(self, inplace=False, ascending=True, na_position='last'):
15931593
15941594
Returns
15951595
-------
1596-
y : Categorical or None
1596+
Categorical or None
15971597
15981598
See Also
15991599
--------
@@ -1667,7 +1667,7 @@ def _values_for_rank(self):
16671667
16681668
Returns
16691669
-------
1670-
numpy array
1670+
numpy.array
16711671
16721672
"""
16731673
from pandas import Series
@@ -1695,7 +1695,7 @@ def ravel(self, order='C'):
16951695
16961696
Returns
16971697
-------
1698-
raveled : numpy array
1698+
numpy.array
16991699
"""
17001700
return np.array(self)
17011701

pandas/core/arrays/datetimelike.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def strftime(self, date_format):
144144
Return an Index of formatted strings specified by date_format, which
145145
supports the same string format as the python standard library. Details
146146
of the string format can be found in `python string format
147-
doc <%(URL)s>`__
147+
doc <%(URL)s>`__.
148148
149149
Parameters
150150
----------
@@ -748,7 +748,7 @@ def _maybe_mask_results(self, result, fill_value=iNaT, convert=None):
748748
mask the result if needed, convert to the provided dtype if its not
749749
None
750750
751-
This is an internal routine
751+
This is an internal routine.
752752
"""
753753

754754
if self._hasnans:
@@ -1047,7 +1047,7 @@ def _sub_period_array(self, other):
10471047
Returns
10481048
-------
10491049
result : np.ndarray[object]
1050-
Array of DateOffset objects; nulls represented by NaT
1050+
Array of DateOffset objects; nulls represented by NaT.
10511051
"""
10521052
if not is_period_dtype(self):
10531053
raise TypeError("cannot subtract {dtype}-dtype from {cls}"

pandas/core/frame.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -2696,7 +2696,7 @@ def get_value(self, index, col, takeable=False):
26962696
26972697
Returns
26982698
-------
2699-
scalar value
2699+
scalar
27002700
"""
27012701

27022702
warnings.warn("get_value is deprecated and will be removed "
@@ -2736,7 +2736,7 @@ def set_value(self, index, col, value, takeable=False):
27362736
----------
27372737
index : row label
27382738
col : column label
2739-
value : scalar value
2739+
value : scalar
27402740
takeable : interpret the index/col as indexers, default False
27412741
27422742
Returns
@@ -6896,7 +6896,7 @@ def round(self, decimals=0, *args, **kwargs):
68966896
68976897
Returns
68986898
-------
6899-
DataFrame :
6899+
DataFrame
69006900
A DataFrame with the affected columns rounded to the specified
69016901
number of decimal places.
69026902
@@ -7000,6 +7000,7 @@ def corr(self, method='pearson', min_periods=1):
70007000
* spearman : Spearman rank correlation
70017001
* callable: callable with input two 1d ndarrays
70027002
and returning a float
7003+
70037004
.. versionadded:: 0.24.0
70047005
70057006
min_periods : int, optional

pandas/core/generic.py

+22-10
Original file line numberDiff line numberDiff line change
@@ -2807,21 +2807,25 @@ def to_latex(self, buf=None, columns=None, col_space=None, header=True,
28072807
defaults to 'ascii' on Python 2 and 'utf-8' on Python 3.
28082808
decimal : str, default '.'
28092809
Character recognized as decimal separator, e.g. ',' in Europe.
2810+
28102811
.. versionadded:: 0.18.0
28112812
multicolumn : bool, default True
28122813
Use \multicolumn to enhance MultiIndex columns.
28132814
The default will be read from the config module.
2815+
28142816
.. versionadded:: 0.20.0
28152817
multicolumn_format : str, default 'l'
28162818
The alignment for multicolumns, similar to `column_format`
28172819
The default will be read from the config module.
2820+
28182821
.. versionadded:: 0.20.0
28192822
multirow : bool, default False
28202823
Use \multirow to enhance MultiIndex rows. Requires adding a
28212824
\usepackage{multirow} to your LaTeX preamble. Will print
28222825
centered labels (instead of top-aligned) across the contained
28232826
rows, separating groups via clines. The default will be read
28242827
from the pandas config module.
2828+
28252829
.. versionadded:: 0.20.0
28262830
28272831
Returns
@@ -4948,11 +4952,15 @@ def pipe(self, func, *args, **kwargs):
49484952
49494953
Returns
49504954
-------
4951-
DataFrame, Series or scalar
4952-
If DataFrame.agg is called with a single function, returns a Series
4953-
If DataFrame.agg is called with several functions, returns a DataFrame
4954-
If Series.agg is called with single function, returns a scalar
4955-
If Series.agg is called with several functions, returns a Series.
4955+
scalar, Series or DataFrame
4956+
4957+
The return can be:
4958+
4959+
* scalar : when Series.agg is called with single function
4960+
* Series : when DataFrame.agg is called with a single function
4961+
* DataFrame : when DataFrame.agg is called with several functions
4962+
4963+
Return scalar, Series or DataFrame.
49564964
49574965
%(see_also)s
49584966
@@ -6879,11 +6887,15 @@ def asof(self, where, subset=None):
68796887
-------
68806888
scalar, Series, or DataFrame
68816889
6882-
Scalar : when `self` is a Series and `where` is a scalar.
6883-
Series: when `self` is a Series and `where` is an array-like,
6884-
or when `self` is a DataFrame and `where` is a scalar.
6885-
DataFrame : when `self` is a DataFrame and `where` is an
6886-
array-like.
6890+
The return can be:
6891+
6892+
* scalar : when `self` is a Series and `where` is a scalar
6893+
* Series: when `self` is a Series and `where` is an array-like,
6894+
or when `self` is a DataFrame and `where` is a scalar
6895+
* DataFrame : when `self` is a DataFrame and `where` is an
6896+
array-like
6897+
6898+
Return scalar, Series, or DataFrame.
68876899
68886900
See Also
68896901
--------

pandas/core/indexes/base.py

+12-11
Original file line numberDiff line numberDiff line change
@@ -1443,7 +1443,7 @@ def sortlevel(self, level=None, ascending=True, sort_remaining=None):
14431443
14441444
Returns
14451445
-------
1446-
sorted_index : Index
1446+
Index
14471447
"""
14481448
return self.sort_values(return_indexer=True, ascending=ascending)
14491449

@@ -1461,7 +1461,7 @@ def _get_level_values(self, level):
14611461
14621462
Returns
14631463
-------
1464-
values : Index
1464+
Index
14651465
Calling object, as there is only one level in the Index.
14661466
14671467
See Also
@@ -1506,7 +1506,7 @@ def droplevel(self, level=0):
15061506
15071507
Returns
15081508
-------
1509-
index : Index or MultiIndex
1509+
Index or MultiIndex
15101510
"""
15111511
if not isinstance(level, (tuple, list)):
15121512
level = [level]
@@ -1558,11 +1558,11 @@ def droplevel(self, level=0):
15581558
Returns
15591559
-------
15601560
grouper : Index
1561-
Index of values to group on
1561+
Index of values to group on.
15621562
labels : ndarray of int or None
1563-
Array of locations in level_index
1563+
Array of locations in level_index.
15641564
uniques : Index or None
1565-
Index of unique values for level
1565+
Index of unique values for level.
15661566
"""
15671567

15681568
@Appender(_index_shared_docs['_get_grouper_for_level'])
@@ -2972,9 +2972,10 @@ def _convert_listlike_indexer(self, keyarr, kind=None):
29722972
29732973
Returns
29742974
-------
2975-
tuple (indexer, keyarr)
2976-
indexer is an ndarray or None if cannot convert
2977-
keyarr are tuple-safe keys
2975+
indexer : numpy.ndarray or None
2976+
Return an ndarray or None if cannot convert.
2977+
keyarr : numpy.ndarray
2978+
Return tuple-safe keys.
29782979
"""
29792980
if isinstance(keyarr, Index):
29802981
keyarr = self._convert_index_indexer(keyarr)
@@ -3158,9 +3159,9 @@ def _reindex_non_unique(self, target):
31583159
Returns
31593160
-------
31603161
new_index : pd.Index
3161-
Resulting index
3162+
Resulting index.
31623163
indexer : np.ndarray or None
3163-
Indices of output values in original index
3164+
Indices of output values in original index.
31643165
31653166
"""
31663167

pandas/core/indexes/multi.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def _codes_to_ints(self, codes):
6161
Returns
6262
------
6363
int_keys : scalar or 1-dimensional array, of dtype uint64
64-
Integer(s) representing one combination (each)
64+
Integer(s) representing one combination (each).
6565
"""
6666
# Shift the representation of each level by the pre-calculated number
6767
# of bits:
@@ -101,7 +101,7 @@ def _codes_to_ints(self, codes):
101101
Returns
102102
------
103103
int_keys : int, or 1-dimensional array of dtype object
104-
Integer(s) representing one combination (each)
104+
Integer(s) representing one combination (each).
105105
"""
106106

107107
# Shift the representation of each level by the pre-calculated number
@@ -2195,7 +2195,7 @@ def reindex(self, target, method=None, level=None, limit=None,
21952195
new_index : pd.MultiIndex
21962196
Resulting index
21972197
indexer : np.ndarray or None
2198-
Indices of output values in original index
2198+
Indices of output values in original index.
21992199
22002200
"""
22012201
# GH6552: preserve names when reindexing to non-named target

pandas/core/series.py

+2
Original file line numberDiff line numberDiff line change
@@ -1669,6 +1669,8 @@ def unique(self):
16691669
* Sparse
16701670
* IntegerNA
16711671
1672+
See Examples section.
1673+
16721674
Examples
16731675
--------
16741676
>>> pd.Series([2, 1, 3, 3], name='A').unique()

pandas/io/excel/_base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ class ExcelWriter(object):
510510
mode : {'w' or 'a'}, default 'w'
511511
File mode to use (write or append).
512512
513-
.. versionadded:: 0.24.0
513+
.. versionadded:: 0.24.0
514514
515515
Attributes
516516
----------

0 commit comments

Comments
 (0)