Skip to content

Commit 18a9e4c

Browse files
jb8429datapythonista
authored andcommitted
DOC: Fixed PR08 and PR09 docstring errors in pandas.Series (#28845)
1 parent 851ca1a commit 18a9e4c

File tree

12 files changed

+197
-178
lines changed

12 files changed

+197
-178
lines changed

pandas/core/accessor.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def _add_delegate_accessors(cls, delegate, accessors, typ, overwrite=False):
7171
accessors : string list of accessors to add
7272
typ : 'property' or 'method'
7373
overwrite : boolean, default False
74-
overwrite the method/property in the target class if it exists.
74+
Overwrite the method/property in the target class if it exists.
7575
"""
7676

7777
def _create_delegator_property(name):
@@ -118,12 +118,12 @@ def delegate_names(delegate, accessors, typ, overwrite=False):
118118
Parameters
119119
----------
120120
delegate : object
121-
the class to get methods/properties & doc-strings
121+
The class to get methods/properties & doc-strings.
122122
accessors : Sequence[str]
123-
List of accessor to add
123+
List of accessor to add.
124124
typ : {'property', 'method'}
125125
overwrite : boolean, default False
126-
overwrite the method/property in the target class if it exists
126+
Overwrite the method/property in the target class if it exists.
127127
128128
Returns
129129
-------
@@ -157,11 +157,11 @@ class CachedAccessor:
157157
Parameters
158158
----------
159159
name : str
160-
The namespace this will be accessed under, e.g. ``df.foo``
160+
The namespace this will be accessed under, e.g. ``df.foo``.
161161
accessor : cls
162162
The class with the extension methods. The class' __init__ method
163163
should expect one of a ``Series``, ``DataFrame`` or ``Index`` as
164-
the single argument ``data``
164+
the single argument ``data``.
165165
"""
166166

167167
def __init__(self, name, accessor):

pandas/core/arrays/categorical.py

+14-12
Original file line numberDiff line numberDiff line change
@@ -912,24 +912,26 @@ def rename_categories(self, new_categories, inplace=False):
912912
----------
913913
new_categories : list-like, dict-like or callable
914914
915-
* list-like: all items must be unique and the number of items in
916-
the new categories must match the existing number of categories.
915+
New categories which will replace old categories.
917916
918-
* dict-like: specifies a mapping from
919-
old categories to new. Categories not contained in the mapping
920-
are passed through and extra categories in the mapping are
921-
ignored.
917+
* list-like: all items must be unique and the number of items in
918+
the new categories must match the existing number of categories.
922919
923-
.. versionadded:: 0.21.0
920+
* dict-like: specifies a mapping from
921+
old categories to new. Categories not contained in the mapping
922+
are passed through and extra categories in the mapping are
923+
ignored.
924924
925-
* callable : a callable that is called on all items in the old
926-
categories and whose return values comprise the new categories.
925+
.. versionadded:: 0.21.0.
927926
928-
.. versionadded:: 0.23.0
927+
* callable : a callable that is called on all items in the old
928+
categories and whose return values comprise the new categories.
929+
930+
.. versionadded:: 0.23.0.
929931
930932
inplace : bool, default False
931-
Whether or not to rename the categories inplace or return a copy of
932-
this categorical with renamed categories.
933+
Whether or not to rename the categories inplace or return a copy of
934+
this categorical with renamed categories.
933935
934936
Returns
935937
-------

pandas/core/arrays/datetimelike.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class TimelikeOps:
207207
ambiguous times)
208208
- 'NaT' will return NaT where there are ambiguous times
209209
- 'raise' will raise an AmbiguousTimeError if there are ambiguous
210-
times
210+
times.
211211
212212
.. versionadded:: 0.24.0
213213
@@ -223,7 +223,7 @@ class TimelikeOps:
223223
- 'NaT' will return NaT where there are nonexistent times
224224
- timedelta objects will shift nonexistent times by the timedelta
225225
- 'raise' will raise an NonExistentTimeError if there are
226-
nonexistent times
226+
nonexistent times.
227227
228228
.. versionadded:: 0.24.0
229229

pandas/core/arrays/datetimes.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,7 @@ def tz_localize(self, tz, ambiguous="raise", nonexistent="raise", errors=None):
993993
ambiguous times)
994994
- 'NaT' will return NaT where there are ambiguous times
995995
- 'raise' will raise an AmbiguousTimeError if there are ambiguous
996-
times
996+
times.
997997
998998
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta, \
999999
default 'raise'
@@ -1007,11 +1007,12 @@ def tz_localize(self, tz, ambiguous="raise", nonexistent="raise", errors=None):
10071007
- 'NaT' will return NaT where there are nonexistent times
10081008
- timedelta objects will shift nonexistent times by the timedelta
10091009
- 'raise' will raise an NonExistentTimeError if there are
1010-
nonexistent times
1010+
nonexistent times.
10111011
10121012
.. versionadded:: 0.24.0
10131013
10141014
errors : {'raise', 'coerce'}, default None
1015+
The method to handle errors:
10151016
10161017
- 'raise' will raise a NonExistentTimeError if a timestamp is not
10171018
valid in the specified time zone (e.g. due to a transition from
@@ -1871,7 +1872,7 @@ def sequence_to_dt64ns(
18711872
dayfirst : bool, default False
18721873
yearfirst : bool, default False
18731874
ambiguous : str, bool, or arraylike, default 'raise'
1874-
See pandas._libs.tslibs.conversion.tz_localize_to_utc
1875+
See pandas._libs.tslibs.conversion.tz_localize_to_utc.
18751876
int_as_wall_time : bool, default False
18761877
Whether to treat ints as wall time in specified timezone, or as
18771878
nanosecond-precision UNIX epoch (wall time in UTC).
@@ -2015,7 +2016,7 @@ def objects_to_datetime64ns(
20152016
dayfirst : bool
20162017
yearfirst : bool
20172018
utc : bool, default False
2018-
Whether to convert timezone-aware timestamps to UTC
2019+
Whether to convert timezone-aware timestamps to UTC.
20192020
errors : {'raise', 'ignore', 'coerce'}
20202021
allow_object : bool
20212022
Whether to return an object-dtype ndarray instead of raising if the

pandas/core/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ def to_numpy(self, dtype=None, copy=False):
906906
Parameters
907907
----------
908908
dtype : str or numpy.dtype, optional
909-
The dtype to pass to :meth:`numpy.asarray`
909+
The dtype to pass to :meth:`numpy.asarray`.
910910
copy : bool, default False
911911
Whether to ensure that the returned value is a not a view on
912912
another array. Note that ``copy=False`` does not *ensure* that

0 commit comments

Comments
 (0)