> For the complete documentation index, see [llms.txt](https://george-jen.gitbook.io/data-science-with-apach-spark/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://george-jen.gitbook.io/data-science-with-apach-spark/untitled-41.md).

# index

lambda functions are nameless function. lambda functions are usually one line functions. lambda functions are usually used as input parameter to map and filter function.

For example:

Make every element of list \[1,2,3,4,5] square

list(map(lambda x: x\*\*2,\[1,2,3,4,5]))

Output:

\[1, 4, 9, 16, 25]

Filter out odd element, only keep even element of a list

list(filter(lambda x: x%2==0, \[1,2,3,4,5]))

It output below:

\[2,4]
