Arrays Functions and Functional Programming in Python
- Naveen
- 2
This post is dedicated to some of the commonly used numpy function to do with arrays in python.
1 – Remove Duplicate from arrays using numpy
2 – Concatenate two arrays using numpy
3 – Get product of one/two arrays using numpy
4 – Basic maths function of Numpy
Functional Programming
Functional programming is a style of programming that emphasizes the evaluation of expressions rather than the execution of commands.
Common functional methods in Python
- Lambda function
- map() function
- reduce function
- filter() function
Let’s understand them one by one.
Lambda function
An anonymous, in-lined function with lambda.
The parameters of the lambda are defined to the left of the colon. The functional body is defined to the right of the colon.
Map Function
Map takes a function and a collection of items.
It makes a new, empty collection, runs the function on each item in the original collection and inserts each return value into the new collection.
Reduce Function
Reduce takes a function and a collection of items. It returns a value that is created by combining the items.
Filter Function
Filter takes a function and a collection.
It returns a collection of every item for which the function returned True.
Hello There. I found your blog using msn. This is a really well written article. I’ll make sure to bookmark it and return to read more of your useful info. Thanks for the post. I’ll certainly comeback.
wow, awesome article post.Thanks Again. Will read on…