You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Create variable with TRUE if nationality is USAamerican=df['nationality'] =="USA"# Create variable with TRUE if age is greater than 50elderly=df['age'] >50# Select all cases where nationality is USA and age is greater than 50df[american&elderly]
Method2 : Using variable attributes
# Select all cases where the first name is not missing and nationality is USA df[df['first_name'].notnull() & (df['nationality'] =="USA")]