Returns a DataSwim instance with rows in a date range
175990
def daterange_(self, datecol, date_start, op, **args):
        
        df = self._daterange(datecol, date_start, op, **args)
        if df is None:
            self.err("Can not select date range data")
        return self._duplicate_(df)
723449
def date_range(start_date, end_date, increment, period):
    
    next = start_date
    delta = relativedelta.relativedelta(**{period:increment})
    while next <= end_date:
        yield next
        next += delta
908318
def _daterange(self, recarr, date_range):
        
        idx = self._datetime64_index(recarr)
        if idx and len(recarr):
            dts = recarr[idx]
            mask = Series(np.zeros(len(dts)), index=dts)
            start, end = _start_end(date_range, dts)
            mask[start:end] = 1.0
            return recarr[mask.values.astype(bool)]
        return recarr
19136
def _get_data(self):
        
        # Split the list of times into begin and end dates. If only
        # one date is supplied, set both begin and end dates equal to that date.

        body, header, dates_long, dates = self._get_data_raw()

        params = self._get_fwf_params()

        df_body = pd.read_fwf(StringIO(body), **params['body'])
        df_header = pd.read_fwf(StringIO(header), **params['header'])
        df_body['date'] = dates_long

        df_body = self._clean_body_df(df_body)
        df_header = self._clean_header_df(df_header)
        df_header['date'] = dates

        return df_body, df_header
260386
function(rows, options) {
	
	this._options = _.clone(options || {});

	this._getRows( _.map(rows, function(row, key) {
		return new Row( row, this._options );
	}, this) );

	// .find expects an array
	this.filter(this._options.find);

	if (_.isObject(this._options.date_range)) {

		// does the same as select_for only using the dateRangeMatcher method;
		this.filter(this._options.date_range);
	}

	if (this._options.sortBy) {

		// does the same as select_for only using the dateRangeMatcher method;
		this.sortBy( this._options.sortBy, this._options.descending );
	}
	return this;
}
339694
def _get_row_str(self, i):
        
        row_data = ["{:s}".format(self.data['eventID'][i]),
                    "{:g}".format(self.data['year'][i]),
                    "{:g}".format(self.data['month'][i]),
                    "{:g}".format(self.data['day'][i]),
                    "{:g}".format(self.data['hour'][i]),
                    "{:g}".format(self.data['minute'][i]),
                    "{:.1f}".format(self.data['second'][i]),
                    "{:.3f}".format(self.data['longitude'][i]),
                    "{:.3f}".format(self.data['latitude'][i]),
                    "{:.1f}".format(self.data['depth'][i]),
                    "{:.1f}".format(self.data['magnitude'][i])]
        return " ".join(row_data)
545954
def r_date_num(obj, multiple=False):
    """"""
    if isinstance(obj, (list, tuple)):
        it = iter
    else:
        it = LinesIterator
    if multiple:
        datasets = {}
        for line in it(obj):
            label = line[2]
            if label not in datasets:
                datasets[label] = Dataset([Dataset.DATE, Dataset.FLOAT])
                datasets[label].name = label
            datasets[label].parse_elements(line[0:2])
        return datasets.values()
    dataset = Dataset([Dataset.DATE, Dataset.FLOAT])
    return dataset.load(it(obj))
75417
def parse_250_row(row: list) -> BasicMeterData:
    
    return BasicMeterData(row[1], row[2], row[3], row[4], row[5],
                             row[6], row[7], float(row[8]),
                             parse_datetime(row[9]), row[10], row[11], row[12],
                             float(row[13]), parse_datetime(
                                 row[14]), row[15], row[16], row[17],
                             float(row[18]), row[19], row[20],
                             parse_datetime(row[21]), parse_datetime(row[22]))
1028608
def by_date(self, chamber, date):
        ""
        date = parse_date(date)
        return self.by_range(chamber, date, date)
682280
function getNearestDataPoint(mouseX) {
            let dateFromInvertedX = xScale.invert(mouseX);
            let bisectDate = d3Array.bisector(getDate).left;
            let dataEntryIndex = bisectDate(dataByDate, dateFromInvertedX, 1);
            let dataEntryForXPosition = dataByDate[dataEntryIndex];
            let previousDataEntryForXPosition = dataByDate[dataEntryIndex - 1];
            let nearestDataPoint;

            if (previousDataEntryForXPosition && dataEntryForXPosition) {
                nearestDataPoint = findOutNearestDate(dateFromInvertedX, dataEntryForXPosition, previousDataEntryForXPosition);
            } else {
                nearestDataPoint = dataEntryForXPosition;
            }

            return nearestDataPoint;
        }
985129
function (d, range) {
		"use strict";

		var start = new Date(d.getFullYear(), d.getMonth(), d.getDate());
		var stop = null;
		if (range instanceof Date) {
			stop = new Date(range.getFullYear(), range.getMonth(), range.getDate());
		} else {
			stop = new Date(start);
			stop = new Date(stop.setDate(stop.getDate() + parseInt(range, 10)));
		}

		return d3.time.days(Math.min(start, stop), Math.max(start, stop));
	}
270309
def daterange(start, end, delta=timedelta(days=1), lower=Interval.CLOSED, upper=Interval.OPEN):
    """"""
    date_interval = Interval(lower=lower, lower_value=start, upper_value=end, upper=upper)
    current = start if start in date_interval else start + delta
    while current in date_interval:
        yield current
        current = current + delta
415665
def _group_range(records, method):
    

    start_date = records[0].datetime
    end_date = records[-1].datetime
    _fun = DATE_GROUPERS[method]

    d = start_date

    # Day and week use timedelta
    if method not in ["month", "year"]:
        def increment(i):
            return i + timedelta(**{method + 's': 1})

    elif method == "month":
        def increment(i):
            year, month = divmod(i.month + 1, 12)
            if month == 0:
                month = 12
                year = year - 1
            return d.replace(year=d.year + year, month=month)

    elif method == "year":
        def increment(i):
            return d.replace(year=d.year + 1)

    while _fun(d) <= _fun(end_date):
        yield d
        d = increment(d)
21958
def date_range(start, end, length, time_unit='us'):
    
    step = (1./compute_density(start, end, length, time_unit))
    if pd and isinstance(start, pd.Timestamp):
        start = start.to_datetime64()
    step = np.timedelta64(int(round(step)), time_unit)
    return start+step/2.+np.arange(length)*step
1186009
def insert_at(df, sample_date, values):
    
    observed_dt = dt(datetime.now())
    return multi_index_insert_row(df, [sample_date, observed_dt], values)
1187052
private Tuple2<Object, T> mapPkToRow(String timestamp, JSONObject jsonRow, List<String> joinFields) {
        Object joinValue = null;
        T rowValues = null;
        try {
            rowValues = rowMapper.newInstance();
            rowValues.getClass().getMethod("setTimestamp", String.class).invoke(rowValues, timestamp);
            for (Object key : jsonRow.keySet()) {
                String colValue = key.toString();
                Util.applyKVToBean(rowValues, colValue, jsonRow.get(colValue));
                if (joinFields.contains(colValue)) {
                    joinValue = (joinValue == null)?jsonRow.get(colValue):(joinValue + "\u0001" + jsonRow.get(colValue));
                }
            }
            if (joinFields.contains("timestamp")) {// Join field could contain timestamp(timestamp can be out of the actual data JSON, so we try this way)
                joinValue = (joinValue == null)?timestamp:(joinValue + "\u0001" + timestamp);
            }
        } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException | IllegalArgumentException | InvocationTargetException ex) {
            Logger.getLogger(Joiner4Bean.class.getName()).log(Level.SEVERE, null, ex);
        }
        return new Tuple2<>(joinValue, rowValues);
    }
539631
private void display(ResultSet rows) {

    final int width1 = 38;
    final int width2 = 12;
    final int width3 = 30;
    final int width4 = 21;

    String format = "%-" + width1 + "s%-" + width2 + "s%-" + width3 + "s%-" + width4 + "s%n";

    // headings
    System.out.printf(format, "sensor_id", "date", "timestamp", "value");

    // separators
    drawLine(width1, width2, width3, width4);

    // data
    for (Row row : rows) {

      System.out.printf(
          format,
          row.getUuid("sensor_id"),
          row.getLocalDate("date"),
          row.getInstant("timestamp"),
          row.getDouble("value"));
    }
  }