DATA MUNGING
DATA CLEANING PYTHON
MACHINE LEARNING RECIPES
PANDAS CHEATSHEET
ALL TAGS
# How to SUBTRACT numerical value to each element of a matrix?

# How to SUBTRACT numerical value to each element of a matrix?

This recipe helps you SUBTRACT numerical value to each element of a matrix

How do you do mathematical operation on a matrix i.e on the elements of matrix?

So this is the recipe on how we can subtract something to each electment of a matrix.

We have imported numpy which is needed.
```
import numpy as np
```

We have calculated a matrix on which we will perform operation.
```
matrixA = np.array([[2, 3, 23],
[5, 6, 25],
[8, 9, 28]])
```

We have made a function that will substract a number in this case 15 to every element of matrix. Finally we have printed the matrix.
```
add_100 = lambda i: i - 15
vectorized_add_100 = np.vectorize(add_100)
print(vectorized_add_100(matrixA))
```

So the output comes as

[[-13 -12 8] [-10 -9 10] [ -7 -6 13]]

Data Science Project in R-Predict the sales for each department using historical markdown data from the Walmart dataset containing data of 45 Walmart stores.

In this project, we are going to work on Deep Learning using H2O to predict Census income.

In this NLP AI application, we build the core conversational engine for a chatbot. We use the popular NLTK text classification library to achieve this.

In this deep learning project, you will build a classification system where to precisely identify human fitness activities.

In this data science project, you will learn how to perform market basket analysis with the application of Apriori and FP growth algorithms based on the concept of association rule learning.

In this R data science project, we will explore wine dataset to assess red wine quality. The objective of this data science project is to explore which chemical properties will influence the quality of red wines.

In this data science project, you will work with German credit dataset using classification techniques like Decision Tree, Neural Networks etc to classify loan applications using R.

In this data science project, you will predict borrowers chance of defaulting on credit loans by building a credit score prediction model.

In this data science project in R, we are going to talk about subjective segmentation which is a clustering technique to find out product bundles in sales data.

Data Science Project - Build a recommendation engine which will predict the products to be purchased by an Instacart consumer again.