Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier.
dataframe.pow() function calculates the exponential power of dataframe and other, element-wise (binary operator pow). This function is essentially same as the
dataframe ** other but with a support to fill the missing values in one of the input data.
Syntax: DataFrame.pow(other, axis=’columns’, level=None, fill_value=None)
other : Series, DataFrame, or constant
axis : For Series input, axis to match Series index on
level : Broadcast across a level, matching Index values on the passed MultiIndex level
fill_value : Fill existing missing (NaN) values, and any new element needed for successful DataFrame alignment, with this value before computation. If data in both corresponding DataFrame locations is missing the result will be missing.
**kwargs : Additional keyword arguments are passed into DataFrame.shift or Series.shift.
Returns : result : DataFrame
Example #1: Use
pow() function to find the power of each element in the dataframe. Raise each element in a row to a different power using a series.
Let’s create a Series
Now, let’s use the
dataframe.pow() function to raise each element in a row to different power.
Example #2: Use
pow() function to raise each element of first data frame to the power of corresponding element in the other dataframe.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course