Cube root of the column in pandas python

Getting the cube root of the column in pandas python can be done using power function. Let’s see how to

  •   Get the cube root of the column in pandas python With examples

First let’s create a dataframe

import pandas as pd
import numpy as np

df1 = {
    'State':['Arizona AZ','Georgia GG','Newyork NY','Indiana IN','Florida FL'],
   'Score':[4,47,55,74,31]}

df1 = pd.DataFrame(df1,columns=['State','Score'])
print(df1)

df1 will be

Cube root of the column in pandas python 1

 

Cube root of the column in pandas python:

Cube roots of the column using power function and store it in other column as shown below

df1['Score_cuberoot']=np.power((df1['Score']),1/3)
print(df1)

So the resultant dataframe will be,

Cube root of the column in pandas python 2

 

p Cube root of the column in pandas python                                                                                                           n Cube root of the column in pandas python

Author

  • Sridhar Venkatachalam

    With close to 10 years on Experience in data science and machine learning Have extensively worked on programming languages like R, Python (Pandas), SAS, Pyspark.

    View all posts