v Select Rows With Multiple Filters - Python

Select Rows With Multiple Filters

# import pandas as pd
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)
df
name score
0 A 1
1 B 2
2 C 3
3 D 4
4 E 5
# Select rows of the dataframe where df.score is greater than 1 and less and 5
df[(df['score'] > 1) & (df['score'] < 5)]
name score
1 B 2
2 C 3
3 D 4