Skip to content

Commit 42e8e15

Browse files
committed
test, whatsnew
1 parent 8c1acad commit 42e8e15

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

doc/source/whatsnew/v1.2.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ Indexing
358358
- Bug in :meth:`Index.sort_values` where, when empty values were passed, the method would break by trying to compare missing values instead of pushing them to the end of the sort order. (:issue:`35584`)
359359
- Bug in :meth:`Index.get_indexer` and :meth:`Index.get_indexer_non_unique` where int64 arrays are returned instead of intp. (:issue:`36359`)
360360
- Bug in :meth:`DataFrame.sort_index` where parameter ascending passed as a list on a single level index gives wrong result. (:issue:`32334`)
361+
- Bug in indexing with boolean masks on datetime-like values sometimes returning a view instead of a copy (:issue:`36210`)
361362

362363
Missing
363364
^^^^^^^

pandas/tests/series/indexing/test_boolean.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22
import pytest
33

4-
from pandas import Index, Series
4+
from pandas import Index, Series, date_range
55
import pandas._testing as tm
66
from pandas.core.indexing import IndexingError
77

@@ -128,3 +128,14 @@ def test_get_set_boolean_different_order(string_series):
128128
sel = string_series[ordered > 0]
129129
exp = string_series[string_series > 0]
130130
tm.assert_series_equal(sel, exp)
131+
132+
133+
def test_getitem_boolean_dt64_copies():
134+
# GH#36210
135+
dti = date_range("2016-01-01", periods=4, tz="US/Pacific")
136+
key = np.array([True, True, False, False])
137+
138+
ser = Series(dti._data)
139+
140+
res = ser[key]
141+
assert res._values._data.base is None

0 commit comments

Comments
 (0)