Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Python
  3. Question
Python

How to use “np.in” to filter prohibited values?

Asked by Dia Shrinidhi Jul 8, 2024 664 views 1 answer
Share

About this question

I am currently working on a machine learning-based project in which I need to filter out certain values from a dataset based on specific conditions. I have a particular list of prohibited values that must not be included in the final dataset. I want to ensure that none of these values should appear in the data which I am processing. In other words, given a NumPy array “data” which represents my dataset and a list of prohibited values “prohibited_values”, how should I use the “np.in” to filter out all the entries from “data” which are in the “prohibuted _ values” list? Provide also a Python-based code snippet for achieving this. 

Your answer

1 Answer

More Python discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Python Blogs

Guides, tips and career advice on Python from JanBask experts.