📌  相关文章
📜  基于某些行条件的新数据框 - Python 代码示例

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

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