Matt Eland shows off the apply() function in Pandas:
Pandas is a wonderful library for manipulating tabular data with Python. Out of the box Pandas offers many ways of adding, removing, and updating columns and rows, but sometimes you need a bit more power.
In this article we’ll explore the
apply
function and show how it can be used to run an operation against every row (or column) in your DataFrame – and why you might want to do that.
Read on to see how it works and what additional benefit it provides.