otp.Operation.str.len#

len()#

Get the length of a string.

Returns

The length of the string. If a byte with value 0 is present in the string, its position (0-based) is returned.

Return type

Operation

Examples

>>> data = otp.Ticks(X=["hello", "world!"])
>>> data["LENS"] = data["X"].str.len()
>>> otp.run(data)["LENS"]
0    5
1    6
Name: LENS, dtype: int64