Skip to content

Commit 1962c3f

Browse files
DOC: Resolve RT03 errors for selected methods (#57782)
* Add result information to filter method. * Add return information for first_valid_index method. * Update docstring method for get method. * Remove fixed methods from ignore list of check script * Also remove last_valid_index from ignored method * Fix docstring formatting. * Update pandas/core/generic.py Add default value to doc Co-authored-by: Matthew Roeschke <[email protected]> * Update pandas/core/generic.py Co-authored-by: Matthew Roeschke <[email protected]> * fix too long line in docstring. --------- Co-authored-by: Matthew Roeschke <[email protected]>
1 parent 6a73045 commit 1962c3f

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

ci/code_checks.sh

-5
Original file line numberDiff line numberDiff line change
@@ -614,15 +614,10 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
614614

615615
MSG='Partially validate docstrings (RT03)' ; echo $MSG
616616
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=RT03 --ignore_functions \
617-
pandas.DataFrame.expanding\
618-
pandas.DataFrame.filter\
619-
pandas.DataFrame.first_valid_index\
620-
pandas.DataFrame.get\
621617
pandas.DataFrame.hist\
622618
pandas.DataFrame.infer_objects\
623619
pandas.DataFrame.kurt\
624620
pandas.DataFrame.kurtosis\
625-
pandas.DataFrame.last_valid_index\
626621
pandas.DataFrame.mask\
627622
pandas.DataFrame.max\
628623
pandas.DataFrame.mean\

pandas/core/generic.py

+18-7
Original file line numberDiff line numberDiff line change
@@ -4183,15 +4183,19 @@ def get(self, key, default=None):
41834183
"""
41844184
Get item from object for given key (ex: DataFrame column).
41854185
4186-
Returns default value if not found.
4186+
Returns ``default`` value if not found.
41874187
41884188
Parameters
41894189
----------
41904190
key : object
4191+
Key for which item should be returned.
4192+
default : object, default None
4193+
Default value to return if key is not found.
41914194
41924195
Returns
41934196
-------
41944197
same type as items contained in object
4198+
Item for given key or ``default`` value, if key is not found.
41954199
41964200
Examples
41974201
--------
@@ -5362,10 +5366,11 @@ def filter(
53625366
axis: Axis | None = None,
53635367
) -> Self:
53645368
"""
5365-
Subset the dataframe rows or columns according to the specified index labels.
5369+
Subset the DataFrame or Series according to the specified index labels.
53665370
5367-
Note that this routine does not filter a dataframe on its
5368-
contents. The filter is applied to the labels of the index.
5371+
For DataFrame, filter rows or columns depending on ``axis`` argument.
5372+
Note that this routine does not filter based on content.
5373+
The filter is applied to the labels of the index.
53695374
53705375
Parameters
53715376
----------
@@ -5378,11 +5383,13 @@ def filter(
53785383
axis : {0 or 'index', 1 or 'columns', None}, default None
53795384
The axis to filter on, expressed either as an index (int)
53805385
or axis name (str). By default this is the info axis, 'columns' for
5381-
DataFrame. For `Series` this parameter is unused and defaults to `None`.
5386+
``DataFrame``. For ``Series`` this parameter is unused and defaults to
5387+
``None``.
53825388
53835389
Returns
53845390
-------
5385-
same type as input object
5391+
Same type as caller
5392+
The filtered subset of the DataFrame or Series.
53865393
53875394
See Also
53885395
--------
@@ -11744,11 +11751,15 @@ def _find_valid_index(self, *, how: str) -> Hashable:
1174411751
@doc(position="first", klass=_shared_doc_kwargs["klass"])
1174511752
def first_valid_index(self) -> Hashable:
1174611753
"""
11747-
Return index for {position} non-NA value or None, if no non-NA value is found.
11754+
Return index for {position} non-missing value or None, if no value is found.
11755+
11756+
See the :ref:`User Guide <missing_data>` for more information
11757+
on which values are considered missing.
1174811758
1174911759
Returns
1175011760
-------
1175111761
type of index
11762+
Index of {position} non-missing value.
1175211763
1175311764
Examples
1175411765
--------

0 commit comments

Comments
 (0)