Skip to content

Pandas.series.astype docstring PR02 #28340

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 4 commits into from
Sep 8, 2019
Merged
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5780,11 +5780,11 @@ def astype(self, dtype, copy=True, errors="raise", **kwargs):
Control raising of exceptions on invalid data for provided dtype.

- ``raise`` : allow exceptions to be raised
- ``ignore`` : suppress exceptions. On error return original object
- ``ignore`` : suppress exceptions. On error return original object.

.. versionadded:: 0.20.0

kwargs : keyword arguments to pass on to the constructor
**kwargs : keyword arguments to pass on to the constructor

Returns
-------
Expand Down Expand Up @@ -5845,7 +5845,7 @@ def astype(self, dtype, copy=True, errors="raise", **kwargs):
Convert to ordered categorical type with custom ordering:

>>> cat_dtype = pd.api.types.CategoricalDtype(
... categories=[2, 1], ordered=True)
... categories=[2, 1], ordered=True)
>>> ser.astype(cat_dtype)
0 1
1 2
Expand All @@ -5855,7 +5855,7 @@ def astype(self, dtype, copy=True, errors="raise", **kwargs):
Note that using ``copy=False`` and changing data on a new
pandas object may propagate changes:

>>> s1 = pd.Series([1,2])
>>> s1 = pd.Series([1, 2])
>>> s2 = s1.astype('int64', copy=False)
>>> s2[0] = 10
>>> s1 # note that s1[0] has changed too
Expand Down