bar#

swordfish.function.bar()#

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

参数:
  • 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.

    备注

    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.

返回:

A vector with the same length as X.

返回类型:

Constant