otp.Operation.str.token#

token(sep=' ', n=0)#

Breaks the value into tokens based on the delimiter sep and returns token at position n (zero-based).

Parameters
  • sep (str) – The delimiter, which must be one character used to split the string into tokens.

  • n (int) – Token index to return. For a negative n, count from the end instead of the beginning.

Returns

token at position n

Return type

Operation

Examples

>>> data = otp.Ticks(X=["NYSE_TAQ::TRD"])
>>> data['Y'] = data['X'].str.token(":",-1)
>>> otp.run(data)
        Time              X    Y
0 2003-12-01  NYSE_TAQ::TRD  TRD