Partial Function Applications

Partial function application allows us to create "functions" from other functions with pre-filled arguments. This can be very useful when we want to pipe the output of one function into a function requiring two functions.

Want to learn more? I recommend these Python books: Python for Data Analysis, Python Data Science Handbook, and Introduction to Machine Learning with Python.

Preliminaries

from functools import partial

Create A Function

def multiply(x, y):
    return x * y

Create A Function With Y Pre-Filled

double = partial(multiply, y=2)

Run The Partial Function

double(3)
6