Skip to content

DOC: Fixed PR08 and PR09 docstring errors in pandas.Series #28845

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

Merged
merged 10 commits into from
Oct 14, 2019
12 changes: 6 additions & 6 deletions pandas/core/accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def _add_delegate_accessors(cls, delegate, accessors, typ, overwrite=False):
accessors : string list of accessors to add
typ : 'property' or 'method'
overwrite : boolean, default False
overwrite the method/property in the target class if it exists.
Overwrite the method/property in the target class if it exists.
"""

def _create_delegator_property(name):
Expand Down Expand Up @@ -118,12 +118,12 @@ def delegate_names(delegate, accessors, typ, overwrite=False):
Parameters
----------
delegate : object
the class to get methods/properties & doc-strings
The class to get methods/properties & doc-strings.
accessors : Sequence[str]
List of accessor to add
List of accessor to add.
typ : {'property', 'method'}
overwrite : boolean, default False
overwrite the method/property in the target class if it exists
Overwrite the method/property in the target class if it exists.

Returns
-------
Expand Down Expand Up @@ -157,11 +157,11 @@ class CachedAccessor:
Parameters
----------
name : str
The namespace this will be accessed under, e.g. ``df.foo``
The namespace this will be accessed under, e.g. ``df.foo``.
accessor : cls
The class with the extension methods. The class' __init__ method
should expect one of a ``Series``, ``DataFrame`` or ``Index`` as
the single argument ``data``
the single argument ``data``.
"""

def __init__(self, name, accessor):
Expand Down
26 changes: 14 additions & 12 deletions pandas/core/arrays/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,24 +910,26 @@ def rename_categories(self, new_categories, inplace=False):
----------
new_categories : list-like, dict-like or callable

* list-like: all items must be unique and the number of items in
the new categories must match the existing number of categories.
New categories which will replace old categories.

* dict-like: specifies a mapping from
old categories to new. Categories not contained in the mapping
are passed through and extra categories in the mapping are
ignored.
* list-like: all items must be unique and the number of items in
the new categories must match the existing number of categories.

.. versionadded:: 0.21.0
* dict-like: specifies a mapping from
old categories to new. Categories not contained in the mapping
are passed through and extra categories in the mapping are
ignored.

* callable : a callable that is called on all items in the old
categories and whose return values comprise the new categories.
.. versionadded:: 0.21.0.

.. versionadded:: 0.23.0
* callable : a callable that is called on all items in the old
categories and whose return values comprise the new categories.

.. versionadded:: 0.23.0.

inplace : bool, default False
Whether or not to rename the categories inplace or return a copy of
this categorical with renamed categories.
Whether or not to rename the categories inplace or return a copy of
this categorical with renamed categories.

Returns
-------
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/arrays/datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class TimelikeOps:
ambiguous times)
- 'NaT' will return NaT where there are ambiguous times
- 'raise' will raise an AmbiguousTimeError if there are ambiguous
times
times.

.. versionadded:: 0.24.0

Expand All @@ -223,7 +223,7 @@ class TimelikeOps:
- 'NaT' will return NaT where there are nonexistent times
- timedelta objects will shift nonexistent times by the timedelta
- 'raise' will raise an NonExistentTimeError if there are
nonexistent times
nonexistent times.

.. versionadded:: 0.24.0

Expand Down
9 changes: 5 additions & 4 deletions pandas/core/arrays/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ def tz_localize(self, tz, ambiguous="raise", nonexistent="raise", errors=None):
ambiguous times)
- 'NaT' will return NaT where there are ambiguous times
- 'raise' will raise an AmbiguousTimeError if there are ambiguous
times
times.

nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta, \
default 'raise'
Expand All @@ -1007,11 +1007,12 @@ def tz_localize(self, tz, ambiguous="raise", nonexistent="raise", errors=None):
- 'NaT' will return NaT where there are nonexistent times
- timedelta objects will shift nonexistent times by the timedelta
- 'raise' will raise an NonExistentTimeError if there are
nonexistent times
nonexistent times.

.. versionadded:: 0.24.0

errors : {'raise', 'coerce'}, default None
The method to handle errors:

- 'raise' will raise a NonExistentTimeError if a timestamp is not
valid in the specified time zone (e.g. due to a transition from
Expand Down Expand Up @@ -1871,7 +1872,7 @@ def sequence_to_dt64ns(
dayfirst : bool, default False
yearfirst : bool, default False
ambiguous : str, bool, or arraylike, default 'raise'
See pandas._libs.tslibs.conversion.tz_localize_to_utc
See pandas._libs.tslibs.conversion.tz_localize_to_utc.
int_as_wall_time : bool, default False
Whether to treat ints as wall time in specified timezone, or as
nanosecond-precision UNIX epoch (wall time in UTC).
Expand Down Expand Up @@ -2015,7 +2016,7 @@ def objects_to_datetime64ns(
dayfirst : bool
yearfirst : bool
utc : bool, default False
Whether to convert timezone-aware timestamps to UTC
Whether to convert timezone-aware timestamps to UTC.
errors : {'raise', 'ignore', 'coerce'}
allow_object : bool
Whether to return an object-dtype ndarray instead of raising if the
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ def to_numpy(self, dtype=None, copy=False):
Parameters
----------
dtype : str or numpy.dtype, optional
The dtype to pass to :meth:`numpy.asarray`
The dtype to pass to :meth:`numpy.asarray`.
copy : bool, default False
Whether to ensure that the returned value is a not a view on
another array. Note that ``copy=False`` does not *ensure* that
Expand Down
Loading