bar#

swordfish.function.bar()#

bar can group X based on the length specified by interval.

Parameters:
  • X (Constant) – An integral/temporal scalar or vector.

  • interval (Constant) –

    An integral/DURATION type scalar greater than 0 or a vector of the same length as X. When interval is of type DURATION, the following time units are supported (case-sensitive): w, d, H, m, s, ms, us, ns.

    Note

    As time units y and M are not supported in interval, to group X by year or month, convert the data format of X with function month or year. Specify the interval as an integer for calculation. You can refer to Example 2.

  • closed (Constant, optional) – A string which can take ‘left’ (default) or ‘right’, indicating whether an element of X that is divisible by interval is the left boundary (the first element of the group) or the right boundary (the last element of the group) of a group, by default DFLT.

Returns:

A vector with the same length as X.

Return type:

Constant