cudf.Series.sqrt#

Series.sqrt()#

Get the non-negative square-root of all elements, element-wise.

Returns
DataFrame/Series/Index

Result of the non-negative square-root of each element.

Examples

>>> import cudf
>>> import cudf
>>> ser = cudf.Series([10, 25, 81, 1.0, 100])
>>> ser
0     10.0
1     25.0
2     81.0
3      1.0
4    100.0
dtype: float64
>>> ser.sqrt()
0     3.162278
1     5.000000
2     9.000000
3     1.000000
4    10.000000
dtype: float64

sqrt operation on DataFrame:

>>> df = cudf.DataFrame({'first': [-10.0, 100, 625],
...                      'second': [1, 2, 0.4]})
>>> df
   first  second
0  -10.0     1.0
1  100.0     2.0
2  625.0     0.4
>>> df.sqrt()
   first    second
0    NaN  1.000000
1   10.0  1.414214
2   25.0  0.632456

sqrt operation on Index:

>>> index = cudf.Index([-10.0, 100, 625])
>>> index
Float64Index([-10.0, 100.0, 625.0], dtype='float64')
>>> index.sqrt()
Float64Index([nan, 10.0, 25.0], dtype='float64')