otp.Operation.str.match#
- match(pat, case=True)#
Match the text against a regular expression specified in the
pat
parameter.- Parameters
- Returns
True
if the match was successful,False
otherwise. Note that boolean Operation is converted to float if added as a column.- Return type
Examples
>>> data = otp.Ticks(X=['hello', 'there were 77 ticks']) >>> data['Y'] = data['X'].str.match('\d\d') >>> otp.run(data) Time X Y 0 2003-12-01 00:00:00.000 hello 0.0 1 2003-12-01 00:00:00.001 there were 77 ticks 1.0
Other columns can be used as parameter
pat
too:>>> data = otp.Tick(X='OneTick', PAT='onetick') >>> data['Y'] = data['X'].str.match(data['PAT'], case=False) >>> otp.run(data) Time X PAT Y 0 2003-12-01 OneTick onetick 1.0