...

/

Lambda Expression, Map and Filter

Lambda Expression, Map and Filter

Let’s learn about the lambda expression and its use with map and filter methods.

Lambda expression

Now that we know the basics of functions, we can move on and learn about the lambda expression. We’ll be using lambda expressions extensively in our pandas library.

  • A lambda expression can be used to create a small anonymous function, that is, a function without any name.
  • These throw-away functions are created where we need them.
  • Lambda expressions are mainly used in combination with the filter() and map() built-in functions.

The general syntax of a lambda expression is:

lambda argument_list: expression

In the syntax above, argument_list consists of a ...