Skip to content

Commit

Permalink
NDFrame.astype doc string, adding part with copy=False
Browse files Browse the repository at this point in the history
  • Loading branch information
tp committed Aug 8, 2017
1 parent d9b9411 commit b366925
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3665,6 +3665,18 @@ def astype(self, dtype, copy=True, errors='raise', **kwargs):
1 2
dtype: category
Categories (2, int64): [2 < 1]
Note that using ``copy=False`` and changing data on a new
pandas object may propagate changes upwards:
>>> cat1 = pd.Series([1,2], dtype='category')
>>> cat2 = cat1.astype('category', copy=False)
>>> cat2[0] = 2
>>> cat1 # note that cat1[0] is changed too
0 2
1 2
dtype: category
Categories (2, int64): [1, 2]
"""
if is_dict_like(dtype):
if self.ndim == 1: # i.e. Series
Expand Down

0 comments on commit b366925

Please sign in to comment.