Just out of curiosity, what is the difference between df**x
and df.pow(x)
?
Having a dataframe df
with a column named values
you can either do: df.values ** 2
or df.values.pow(2)
to compute the entire column to the power of 2. I understand that you can change the axis while using DataFrame.pow
. But is there a difference in performance? Will changing the power influence the performance?
df = pd.DataFrame([1.,2])
df**2
df.pow(2)
I have read the discussion between the difference between x**y
and x.pow(y)
from the math
-module here