Skip to content

Commit

Permalink
fix for pandas-dev#16889 along with test
Browse files Browse the repository at this point in the history
  • Loading branch information
hugo committed Jul 12, 2017
1 parent 9d13227 commit fb7f211
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 4 additions & 2 deletions pandas/core/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 8 additions & 1 deletion pandas/tests/indexing/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fb7f211

Please sign in to comment.