Understanding a function
What is a function anyway? In programming, a function is a named section of code that encapsulates a specific task and can be used relatively independently of surrounding code. Most (but not all) functions are stateless—their outcome depends solely on the function's explicit inputs.
Functions are ubiquitous in Python code. In fact, we have used some functions already; print is one example. Those functions are part of Python's default arsenal of built-in functions. There are 69 built-in functions in total in modern pandas. Before we start writing functions on our own, let's review these built-in functions first.
In the following sections, we will discuss just a handful of functions that we'll use frequently throughout ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access