Find the index corresponding to the rightmost
value less than or equal to *dt*.
If *dt* is less than :func:`dynts.TimeSeries.end`
a :class:`dynts.exceptions.LeftOutOfBound`
exception will raise.

*dt* must be a python datetime.date instance.
965724
def find_le(self, dt):
        ''''''
        i = bisect_right(self.dates, dt)
        if i:
            return i-1
        raise LeftOutOfBound
585895
def last(self):
        
        if self._last is UNDETERMINED:
            # not necessarily the last one...
            self._last = self.sdat.tseries.index[-1]
        return self[self._last]
18710
def get_delta(value):
    
    if isinstance(value, (int, float)):
        return timedelta(seconds=value)
    elif isinstance(value, timedelta):
        return value
    raise Exception('Invalid delta')
190251
def get_rightmost_index(byte_index=0, file_starts=[0]):

    '''
    
    '''
    i = 1
    while i <= len(file_starts):
        start = file_starts[-i]
        if start <= byte_index:
            return len(file_starts) - i
        else:
            i += 1
    else:
        raise Exception('byte_index lower than all file_starts')
149744
def should_series_dispatch(left, right, op):
    
    if left._is_mixed_type or right._is_mixed_type:
        return True

    if not len(left.columns) or not len(right.columns):
        # ensure obj.dtypes[0] exists for each obj
        return False

    ldtype = left.dtypes.iloc[0]
    rdtype = right.dtypes.iloc[0]

    if ((is_timedelta64_dtype(ldtype) and is_integer_dtype(rdtype)) or
            (is_timedelta64_dtype(rdtype) and is_integer_dtype(ldtype))):
        # numpy integer dtypes as timedelta64 dtypes in this scenario
        return True

    if is_datetime64_dtype(ldtype) and is_object_dtype(rdtype):
        # in particular case where right is an array of DateOffsets
        return True

    return False
1128909
private DateTime providedOrDefaultFromValue(DateTime from, DateTime to,
			AggregateCounterResolution resolution) {
		if (from != null) {
			return from;
		}
		switch (resolution) {
		case minute:
			return to.minusMinutes(59);
		case hour:
			return to.minusHours(23);
		case day:
			return to.minusDays(6);
		case month:
			return to.minusMonths(11);
		case year:
			return to.minusYears(4);
		default:
			throw new IllegalStateException(
					"Shouldn't happen. Unhandled resolution: " + resolution);
		}
	}
802812
def _check_zone_exception_for_date(self, item, timestamp, data_dict, data_index_dict):
        
        if item in data_index_dict:
            for item in data_index_dict[item]:

                # startdate < timestamp
                if const.START in data_dict[item] and not const.END in data_dict[item]:
                    if data_dict[item][const.START] < timestamp:
                        return data_dict[item][const.CQZ]

                # enddate > timestamp
                elif not const.START in data_dict[item] and const.END in data_dict[item]:
                    if data_dict[item][const.END] > timestamp:
                        return data_dict[item][const.CQZ]

                # startdate > timestamp > enddate
                elif const.START in data_dict[item] and const.END in data_dict[item]:
                    if data_dict[item][const.START] < timestamp \
                            and data_dict[item][const.END] > timestamp:
                        return data_dict[item][const.CQZ]

                # no startdate or enddate available
                elif not const.START in data_dict[item] and not const.END in data_dict[item]:
                        return data_dict[item][const.CQZ]

        raise KeyError
1142235
def searchsorted(self, value, side="left", sorter=None):
        

        # We are much more performant if the searched
        # indexer is the same type as the array.
        #
        # This doesn't matter for int64, but DOES
        # matter for smaller int dtypes.
        #
        # xref: https://github.com/numpy/numpy/issues/5370
        try:
            value = self.dtype.type(value)
        except ValueError:
            pass

        return super().searchsorted(value, side=side, sorter=sorter)
166888
def _lookup(self, timestamp):
        

        idx = search_greater(self._values, timestamp)
        if (idx < len(self._values)
                and math.fabs(self._values[idx][0] - timestamp) < self.EPSILON):
            return idx
        return None
669074
def _nan_minmax_object(func, fill_value, value, axis=None, **kwargs):
    
    valid_count = count(value, axis=axis)
    filled_value = fillna(value, fill_value)
    data = getattr(np, func)(filled_value, axis=axis, **kwargs)
    if not hasattr(data, 'dtype'):  # scalar case
        data = dtypes.fill_value(value.dtype) if valid_count == 0 else data
        return np.array(data, dtype=value.dtype)
    return where_method(data, valid_count != 0)
729563
def _try_pydatetime(x):
    
    try:
        # for datetimeindex
        x = [y.isoformat() for y in x.to_pydatetime()]
    except AttributeError:
        pass
    try:
        # for generic series
        x = [y.isoformat() for y in x.dt.to_pydatetime()]
    except AttributeError:
        pass
    return x
781267
function findLastCommonIndex(xs, ys) {
    for (let i = Math.min(xs.length, ys.length) - 1; i >= 0; --i) {
        if (xs[i] === ys[i]) {
            return i
        }
    }
    return -1
}
277087
def min(self):
        
        return self._constructor(self.values.min(axis=self.baseaxes, keepdims=True))
1173479
def get_min_from_t(self, timestamp):
        
        if self.is_time_valid(timestamp):
            return timestamp
        t_day_epoch = get_day(timestamp)
        tr_mins = self.get_min_sec_from_morning()
        return t_day_epoch + tr_mins
73150
def lessThan(self, leftIndex, rightIndex):
        
        leftData  = self.sourceModel().data(leftIndex,  RegistryTableModel.SORT_ROLE)
        rightData = self.sourceModel().data(rightIndex, RegistryTableModel.SORT_ROLE)

        return leftData < rightData
943963
public Object getValue(int x) {
    if (x >= width())
      throw new IllegalArgumentException("Index out of scope on axis (" + x + " >= " + width() + ")!");

    return m_Min + m_Step*x;
  }
749502
def get_std_end_date(self):
        
        _, second = self._val
        if second != datetime.max:
            return second.strftime("%Y-%m-%d %H:%M:%S")
        else:
            return ""