cudf.Series.cos#

Series.cos()#

Get Trigonometric cosine, element-wise.

Returns
DataFrame/Series/Index

Result of the trigonometric operation.

Examples

>>> import cudf
>>> ser = cudf.Series([0.0, 0.32434, 0.5, 45, 90, 180, 360])
>>> ser
0      0.00000
1      0.32434
2      0.50000
3     45.00000
4     90.00000
5    180.00000
6    360.00000
dtype: float64
>>> ser.cos()
0    1.000000
1    0.947861
2    0.877583
3    0.525322
4   -0.448074
5   -0.598460
6   -0.283691
dtype: float64

cos operation on DataFrame:

>>> df = cudf.DataFrame({'first': [0.0, 5, 10, 15],
...                      'second': [100.0, 360, 720, 300]})
>>> df
   first  second
0    0.0   100.0
1    5.0   360.0
2   10.0   720.0
3   15.0   300.0
>>> df.cos()
      first    second
0  1.000000  0.862319
1  0.283662 -0.283691
2 -0.839072 -0.839039
3 -0.759688 -0.022097

cos operation on Index:

>>> index = cudf.Index([-0.4, 100, -180, 90])
>>> index
Float64Index([-0.4, 100.0, -180.0, 90.0], dtype='float64')
>>> index.cos()
Float64Index([ 0.9210609940028851,  0.8623188722876839,
            -0.5984600690578581, -0.4480736161291701],
            dtype='float64')