Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pandas/tseries/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,9 @@ def __contains__(self, key):
except (KeyError, TypeError):
return False

def unique(self):
return self.asobject.unique()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh, did you test the performance impact of this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about just returning a DatetimeIndex instead of a raw numpy array in this particular case


def isin(self, values):
"""
Compute boolean array of whether each index value is found in the
Expand Down
3 changes: 2 additions & 1 deletion pandas/tseries/tests/test_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ def test_is_unique_monotonic(self):

def test_index_unique(self):
uniques = self.dups.index.unique()
self.assert_(uniques.dtype == 'M8[ns]') # sanity
#self.assert_(uniques.dtype == 'M8[ns]') # sanity
self.assert_(isinstance(uniques[0], tslib.Timestamp))

def test_index_dupes_contains(self):
d = datetime(2011, 12, 5, 20, 30)
Expand Down