diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py index ae0aaf98fdf028..38cc5431a004fc 100755 --- a/pandas/core/indexing.py +++ b/pandas/core/indexing.py @@ -760,10 +760,12 @@ def _align_frame(self, indexer, df): for i, ix in enumerate(indexer): ax = self.obj.axes[i] if is_sequence(ix) or isinstance(ix, slice): + if isinstance(ix, np.ndarray): + ix = ix.ravel() if idx is None: - idx = ax[ix].ravel() + idx = ax[ix] elif cols is None: - cols = ax[ix].ravel() + cols = ax[ix] else: break else: diff --git a/pandas/tests/indexing/test_datetime.py b/pandas/tests/indexing/test_datetime.py index da8a896cb6f4aa..09cb11a5c970c4 100644 --- a/pandas/tests/indexing/test_datetime.py +++ b/pandas/tests/indexing/test_datetime.py @@ -7,7 +7,14 @@ class TestDatetimeIndex(object): - + def test_setitem_with_datetime_tz(self): + mask = np.array([True, False, True, False]) + idx = pd.date_range('20010101', periods=4, tz='UTC') + df = pd.DataFrame({'a' : np.arange(4)}, index=idx).astype('float64') + test = df.copy() + test.loc[mask, :] = df.loc[mask, :] + tm.assert_frame_equal(test, df) + def test_indexing_with_datetime_tz(self): # 8260