Loading...

Function

A reusable named block of code defined with def, taking inputs and returning a value.

When to use: Anywhere you want code reuse, abstraction, or unit testability.

Example: def standardize(x): return (x - x.mean()) / x.std(). list(map(standardize, columns)).

More Python for ML Glossary terms