MACHINE LEARNING RECIPES
DATA CLEANING PYTHON
DATA MUNGING
PANDAS CHEATSHEET
ALL TAGS
# How to replace items that satisfy a condition with another value in numpy array?

# How to replace items that satisfy a condition with another value in numpy array?

This recipe helps you replace items that satisfy a condition with another value in numpy array

How to replace items that satisfy a condition with another value in numpy array? This is possible in the Numpy by using the "where" condition.

```
import numpy as np
```

```
Sample_array = np.array([10,20,30,40,45,50,55,60,65,70,75,80])
print("This is the Sample array:", Sample_array)
```

This is the Sample array: [10 20 30 40 45 50 55 60 65 70 75 80]

```
Result = np.where(Sample_array > 45, 0, Sample_array)
print("This is Resulted array where we have applied condition:", Result)
```

This is Resulted array where we have applied condition: [10 20 30 40 45 0 0 0 0 0 0 0]Here we have applied a condition where if the number is greater than 45 then it will be 0.

Data Science Project in Python- Given his or her job role, predict employee access needs using amazon employee database.

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.

Machine Learning Project in R- Predict the customer churn of telecom sector and find out the key drivers that lead to churn. Learn how the logistic regression model using R can be used to identify the customer churn in telecom dataset.

Music Recommendation Project using Machine Learning - Use the KKBox dataset to predict the chances of a user listening to a song again after their very first noticeable listening event.

In this machine learning project you will work on creating a robust prediction model of Rossmann's daily sales using store, promotion, and competitor data.

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

In this ensemble machine learning project, we will predict what kind of claims an insurance company will get. This is implemented in python using ensemble machine learning algorithms.

In this machine learning project, you will develop a machine learning model to accurately forecast inventory demand based on historical sales data.

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 in Python- Build a machine learning algorithm that automatically suggests the right product prices.