October 2019
Beginner to intermediate
674 pages
16h 43m
English
The apply() method provides us with a fast and efficient way to apply a function to all the values in a series. The function could be a built-in function such as a NumPy function or a user-defined function.
In the following snippet, apply() has been used to find the exponential value of all the rows in the Wins series:
sample_df["Wins"].apply(np.exp)
The following is the output:

You can also define your own function and apply it to a series. Let's demonstrate this with a simple function to divide values by 100:
def div_by_100(x):return x/100sample_df["Nominations"].apply(div_by_100)
The following is ...
Read now
Unlock full access