How to select rows with multiple filters?

How to select rows with multiple filters?

How to select rows with multiple filters?

This recipe helps you select rows with multiple filters

In [1]:
# How to select rows with multiple filters
def Snippet_108():
    print(format('How to select rows with multiple filters','*^82'))

    import warnings

    # load libraries
    import pandas as pd

    # Create an example dataframe
    data = {'name': ['A', 'B', 'C', 'D', 'E'],
            'score': [1,2,3,4,5]}

    df = pd.DataFrame(data)
    print(); print(df)

    # Select rows of the dataframe where df.score is greater than 1 and less and 5
    df1 = df[(df['score'] > 1) & (df['score'] < 5)]
    print(); print(df1)

*********************How to select rows with multiple filters*********************

  name  score
0    A      1
1    B      2
2    C      3
3    D      4
4    E      5

  name  score
1    B      2
2    C      3
3    D      4

Relevant Projects

Data Science Project in Python on BigMart Sales Prediction
The goal of this data science project is to build a predictive model and find out the sales of each product at a given Big Mart store.

Data Science Project-TalkingData AdTracking Fraud Detection
Machine Learning Project in R-Detect fraudulent click traffic for mobile app ads using R data science programming language.

Build an Image Classifier for Plant Species Identification
In this machine learning project, we will use binary leaf images and extracted features, including shape, margin, and texture to accurately identify plant species using different benchmark classification techniques.

PySpark Tutorial - Learn to use Apache Spark with Python
PySpark Project-Get a handle on using Python with Spark through this hands-on data processing spark python tutorial.

Identifying Product Bundles from Sales Data Using R Language
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.

Machine Learning project for Retail Price Optimization
In this machine learning pricing project, we implement a retail price optimization algorithm using regression trees. This is one of the first steps to building a dynamic pricing model.

Human Activity Recognition Using Smartphones Data Set
In this deep learning project, you will build a classification system where to precisely identify human fitness activities.

German Credit Dataset Analysis to Classify Loan Applications
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.

Solving Multiple Classification use cases Using H2O
In this project, we are going to talk about H2O and functionality in terms of building Machine Learning models.

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