DataFrameIntervals

Documentation for DataFrameIntervals.

DataFrameIntervals.groupby_interval_join โ€” Method
groupby_interval_join(left, right, groups; on, renamecols=identity => identity, 
                      renameon=:_left => :_right, makeunique=false)

Similar to, but less resource intensive than

groupby(interval_join(left, right), groups). You can iterate over the groups or call combine on said groups. Note however that the returned object is not a GroupedDataFrame and only supports these two operations.

See also interval_join

DataFrameIntervals.interval_join โ€” Method
interval_join(left, right; on, renamecols=identity => identity, 
              renameon=:_left => :_right, makeunique=false, keepleft=false,
              keepright=false)

Join two dataframes based on the intervals they represent (denoted by the on column); these are typically intervals of time. By default, the join includes one row for every pairing of rows in left and right whose intervals overlap (i.e. !isdisjoint(left.on, right.on))).

  • on: The column name to join left and right on. If the column on which left and right will be joined have different names, then a left=>right pair can be passed. on is a required argument. The value of the on column in the output data frame is the intersection of the left and right interval. on can be one of three different types of objects: an Interval, a TimeSpan or a NamedTuple with a start and a stop field.

  • makeunique: if false (the default), an error will be raised if duplicate names are found in columns not joined on; if true, duplicate names will be suffixed with _i (i starting at 1 for the first duplicate).

  • renamecols: a Pair specifying how columns of left and right data frames should be renamed in the resulting data frame. Each element of the pair can be a string or a Symbol, in which case it is appended to the original column name; alternatively a function can be passed in which case it is applied to each column name, which is passed to it as a String. Note that renamecols does not affect any of the on columns.

  • renameon: a Pair specifying how the left and right data frame on column is renamed and stored in the resulting data frame, following the same format as renamecols.

  • keepleft: if true, keep rows in left that don't match rows in right (ala leftjoin)

  • keepright: if true, keep rows in right that don't match rows in left (ala rightjoin)

DataFrameIntervals.quantile_windows โ€” Method
quantile_windows(n, span; spancol=:span, label=:count => 1:n, 
                 min_duration = 0.75*Intervals.span(span)/n)

Generate a data frame with n rows that divide the interval span into equally spaced intervals. The output is a DataFrame with a :span column and a column of name label with the index for the span (== 1:n). The label argument can also be a pair in which case it should be a symbol paired with an iterable of n items to assign as the value of the given column.

The value span can also be a dataframe, in which case quantiles that cover the entire range of time spans in the dataframe are used.

The output is useful as the right argument to interva_join and groupby_interval_join