📅  最后修改于: 2022-03-11 14:45:29.295000             🧑  作者: Mango
# Create variable with TRUE if nationality is USA
american = df['nationality'] == "USA"
# Create variable with TRUE if age is greater than 50
elderly = df['age'] > 50
# Select all cases where nationality is USA and age is greater than 50
df[american & elderly]