def test_get_loc_nat(self): tidx = TimedeltaIndex(['1 days 01:00:00', 'NaT', '2 days 01:00:00']) assert tidx.get_loc(pd.NaT) == 1 assert tidx.get_loc(None) == 1 assert tidx.get_loc(float('nan')) == 1 assert tidx.get_loc(np.nan) == 1
def test_get_loc_nat(self): tidx = TimedeltaIndex(["1 days 01:00:00", "NaT", "2 days 01:00:00"]) assert tidx.get_loc(pd.NaT) == 1 assert tidx.get_loc(None) == 1 assert tidx.get_loc(float("nan")) == 1 assert tidx.get_loc(np.nan) == 1
def test_get_loc_nat(self): tidx = TimedeltaIndex(['1 days 01:00:00', 'NaT', '2 days 01:00:00']) self.assertEqual(tidx.get_loc(pd.NaT), 1) self.assertEqual(tidx.get_loc(None), 1) self.assertEqual(tidx.get_loc(float('nan')), 1) self.assertEqual(tidx.get_loc(np.nan), 1)
class TimedeltaIndexing(object): def setup(self): self.index = TimedeltaIndex(start='1985', periods=1000, freq='D') self.index2 = TimedeltaIndex(start='1986', periods=1000, freq='D') self.series = Series(range(1000), index=self.index) self.timedelta = self.index[500] def time_get_loc(self): self.index.get_loc(self.timedelta) def time_shape(self): self.index.shape def time_shallow_copy(self): self.index._shallow_copy() def time_series_loc(self): self.series.loc[self.timedelta] def time_align(self): DataFrame({'a': self.series, 'b': self.series[:500]}) def time_intersection(self): self.index.intersection(self.index2) def time_union(self): self.index.union(self.index2) def time_unique(self): self.index.unique()