Related Articles
Find Exponential of a column in Pandas-Python
• Last Updated : 18 Aug, 2020

Let’s see how to find Exponential of a column in Pandas Dataframe. First, let’s create a Dataframe:

## Python3

 # importing pandas and # numpy librariesimport pandas as pdimport numpy as np   # creating and initializing a listvalues= [ ['Rohan', 5, 50.59], ['Elvish', 2, 90.57],         ['Deepak', 10, 98.51], ['Soni', 4, 40.24],          ['Radhika', 1, 99.05], ['Vansh', 15, 85.56] ]   # creating a pandas dataframedf = pd.DataFrame(values, columns = ['Name',                                      'University_Rank',                                      'University_Marks'])  # displaying the data framedf

Output:

The exponential of any column is found out by using numpy.exp() function. This function calculates the exponential of the input array/Series.

Syntax: numpy.exp(array, out = None, where = True, casting = ‘same_kind’, order = ‘K’, dtype = None)

Return: An array with exponential of all elements of input array/Series.

Example 1: Finding exponential of the single column (integer values).

## Python3

 # importing pandas and # numpy librariesimport pandas as pdimport numpy as np   # creating and initializing a listvalues= [ ['Rohan', 5, 50.59], ['Elvish', 2, 90.57],         ['Deepak', 10, 98.51], ['Soni', 4, 40.24],          ['Radhika', 1, 99.05], ['Vansh', 15, 85.56] ]   # creating a pandas dataframedf = pd.DataFrame(values, columns = ['Name',                                      'University_Rank',                                      'University_Marks'])  # finding the exponential value # of cloumn using np.exp() functiondf['exp_value'] = np.exp(df['University_Rank'])  # displaying the data framedf

Output:

Example 2: Finding exponential of the single column (Float values).

## Python3

 # importing pandas and # numpy librariesimport pandas as pdimport numpy as np   # creating and initializing a listvalues= [ ['Rohan', 5, 50.59], ['Elvish', 2, 90.57],         ['Deepak', 10, 98.51], ['Soni', 4, 40.24],          ['Radhika', 1, 99.05], ['Vansh', 15, 85.56] ]   # creating a pandas dataframedf = pd.DataFrame(values, columns = ['Name',                                      'University_Rank',                                      'University_Marks'])  # finding the exponential value # of cloumn  using np.exp() functiondf['exp_value'] = np.exp(df['University_Marks'])  # displaying the data framedf

Output:

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

My Personal Notes arrow_drop_up