Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Lambda Functions | Functions and Modules
Introduction to Data Analysis in Python
course content

Kursinhalt

Introduction to Data Analysis in Python

Introduction to Data Analysis in Python

1. Basics
2. Data Types
3. Control Flow
4. Functions and Modules
5. Introduction to NumPy

book
Lambda Functions

Sometimes you may need to define small one-action function. Especially it's quite useful for preprocessing data. In this case, you can use lambda function.

Lambda function is a small anonymous function (unless you assign it to some variable) that can have many arguments, but only one expression/instruction. To define lambda function use the keyword lambda followed by arguments. Next, set the colon sign, and define the instruction. For example, the circle_area function can be expressed as lambda:

123456789
# Import the library import math # Define lambda function area = lambda R: print("Area:", math.pi*R**2) # Calling function area(5) area(8)
copy

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 4. Kapitel 7

Fragen Sie AI

expand
ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

course content

Kursinhalt

Introduction to Data Analysis in Python

Introduction to Data Analysis in Python

1. Basics
2. Data Types
3. Control Flow
4. Functions and Modules
5. Introduction to NumPy

book
Lambda Functions

Sometimes you may need to define small one-action function. Especially it's quite useful for preprocessing data. In this case, you can use lambda function.

Lambda function is a small anonymous function (unless you assign it to some variable) that can have many arguments, but only one expression/instruction. To define lambda function use the keyword lambda followed by arguments. Next, set the colon sign, and define the instruction. For example, the circle_area function can be expressed as lambda:

123456789
# Import the library import math # Define lambda function area = lambda R: print("Area:", math.pi*R**2) # Calling function area(5) area(8)
copy

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 4. Kapitel 7
Wir sind enttäuscht, dass etwas schief gelaufen ist. Was ist passiert?
some-alt