📜  pandas 按多个条件选择行 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:29.295000             🧑  作者: Mango

代码示例5
# 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]