Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
makbigc committed Nov 18, 2018
1 parent 1250500 commit 72b7ee5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.24.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,7 @@ Indexing
- Bug where setting a timedelta column by ``Index`` causes it to be casted to double, and therefore lose precision (:issue:`23511`)
- Bug in :func:`Index.union` and :func:`Index.intersection` where name of the ``Index`` of the result was not computed correctly for certain cases (:issue:`9943`, :issue:`9862`)
- Bug in :class:`Index` slicing with boolean :class:`Index` may raise ``TypeError`` (:issue:`22533`)
- Bug when :class:`Series` was created from :class:`DatetimeIndex`, the series shares the same underneath data with that index (:issue:`21907`)

Missing
^^^^^^^
Expand Down
6 changes: 5 additions & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ def __init__(self, data=None, index=None, dtype=None, name=None,
data = data.astype(dtype)
else:
# need to copy to avoid aliasing issues
data = data._values.copy()
# GH21907
if isinstance(data, DatetimeIndex):
data = data.copy(deep=True)
else:
data = data._values.copy()
copy = False

elif isinstance(data, np.ndarray):
Expand Down

0 comments on commit 72b7ee5

Please sign in to comment.