Arrays Functions and Functional Programming in Python

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

  1. Lambda function
  2. map() function
  3. reduce function
  4. 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.

Popular Posts

Author

  • Naveen Pandey Data Scientist Machine Learning Engineer

    Naveen Pandey has more than 2 years of experience in data science and machine learning. He is an experienced Machine Learning Engineer with a strong background in data analysis, natural language processing, and machine learning. Holding a Bachelor of Science in Information Technology from Sikkim Manipal University, he excels in leveraging cutting-edge technologies such as Large Language Models (LLMs), TensorFlow, PyTorch, and Hugging Face to develop innovative solutions.

    View all posts
Spread the knowledge
 
  

2 thoughts on “Arrays Functions and Functional Programming in Python

  1. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *