def __init__(self, index, warn=True): self.index = index self.values = np.asarray(index).view('i8') self.warn = warn if len(index) < 3: raise ValueError('Need at least 3 dates to infer frequency') self.deltas = lib.unique_deltas(self.values) self.is_unique = len(self.deltas) == 1 self.is_monotonic = self.index.is_monotonic
def __init__(self, index, warn=True): from pandas.tseries.index import DatetimeIndex if not isinstance(index, DatetimeIndex): index = DatetimeIndex(index) self.index = index self.values = np.asarray(index).view('i8') self.warn = warn if len(index) < 3: raise ValueError('Need at least 3 dates to infer frequency') self.deltas = lib.unique_deltas(self.values) self.is_unique = len(self.deltas) == 1 self.is_monotonic = self.index.is_monotonic
def ydiffs(self): return lib.unique_deltas(self.fields['Y'].astype('i8'))
def mdiffs(self): nmonths = self.fields['Y'] * 12 + self.fields['M'] return lib.unique_deltas(nmonths.astype('i8'))
def ydiffs(self): return lib.unique_deltas(self.fields["Y"].astype("i8"))
def mdiffs(self): nmonths = self.fields["Y"] * 12 + self.fields["M"] return lib.unique_deltas(nmonths.astype("i8"))
def deltas(self): return lib.unique_deltas(self.values)