otp.Operation.float.str#

str(length=10, precision=6)#

Converts float to str.

Converts number to string with given length and precision. The specified length should be greater than or equal to the part of the number before the decimal point plus the number’s sign (if any).

If length is specified as an int, the method will return strings with length characters, if length is specified as a column, the method will return string default (64 characters) length.

Parameters
Returns

result – String representation of float value.

Return type

Operation

Examples

>>> data = otp.Ticks(X=[1, 2.17, 10.31861, 3.141593])
>>> data["X"] = data["X"].float.str(15, 3)
>>> data = otp.run(data)
>>> data["X"]
0    1.000
1    2.170
2    10.319
3    3.142
Name: X, dtype: object
>>> data = otp.Ticks(X=[1, 2.17, 10.31841, 3.141593],
...                  LENGTH=[2, 3, 4, 5],
...                  PRECISION=[5, 5, 3, 3])
>>> data["X"] = data["X"].float.str(data["LENGTH"], data["PRECISION"])
>>> data = otp.run(data)
>>> data["X"]
0    1
1    2.2
2    10.3
3    3.142
Name: X, dtype: object