I grabbed a row from a dataframe which is like the following:
https://i.stack.imgur.com/Y9LUE.png
or
Clicks Spend clk_ar CPC AdRank temp tempRan
36.0 248.76 59.94 6.91 1.67 1.665 1.67
I need to round values with 2 digits in column temp
Option 1:
round(df.temp,2)
OUTPUT:
1676725 1.66
Name: temp, dtype: float64
Option 2:
df.temp.apply(lambda x:round(x,2))
OUTPUT:
1676725 1.67
Name: temp, dtype: float64
The two round functions show different behaviors. Obviously option 1 is aligned with python 3 behavior. See Python 3.x rounding behavior
I am just wondering why option 2 behaves like that. Thanks for your help!