Skip to content

Commit e32ccf9

Browse files
committed
BUG: close #1681 for real
1 parent ee9321f commit e32ccf9

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

RELEASE.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pandas 0.8.2
6464
- Fix field access with UTC->local conversion on unsorted arrays (#1756)
6565
- Fix isnull handling of array-like (list) inputs (#1755)
6666
- Fix regression in handling of Series in Series constructor (#1671)
67-
- Fix another NumPy datetime64 concatenate bug in DataFrame.append (#1681)
67+
- Fix comparison of Int64Index with DatetimeIndex (#1681)
6868
- Fix min_periods handling in new rolling_max/min at array start (#1695)
6969
- Fix errors with how='median' and generic NumPy resampling in some cases
7070
caused by SeriesBinGrouper (#1648, #1688)

pandas/core/index.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,11 @@ def equals(self, other):
12111211
# if not isinstance(other, Int64Index):
12121212
# return False
12131213

1214-
return np.array_equal(self, other)
1214+
try:
1215+
return np.array_equal(self, other)
1216+
except TypeError:
1217+
# e.g. fails in numpy 1.6 with DatetimeIndex #1681
1218+
return False
12151219

12161220
def _wrap_joined_index(self, joined, other):
12171221
name = self.name if self.name == other.name else None

pandas/tseries/tests/test_timeseries.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,6 +1067,14 @@ def test_frame_dict_constructor_datetime64_1680(self):
10671067
DataFrame({'a': 'foo', 'b': s}, index=dr)
10681068
DataFrame({'a': 'foo', 'b': s.values}, index=dr)
10691069

1070+
def test_frame_datetime64_mixed_index_ctor_1681(self):
1071+
dr = date_range('2011/1/1', '2012/1/1', freq='W-FRI')
1072+
ts = Series(dr)
1073+
1074+
# it works!
1075+
d = DataFrame({'A': 'foo', 'B': ts}, index=dr)
1076+
self.assert_(d['B'].isnull().all())
1077+
10701078
def _simple_ts(start, end, freq='D'):
10711079
rng = date_range(start, end, freq=freq)
10721080
return Series(np.random.randn(len(rng)), index=rng)

0 commit comments

Comments
 (0)