oldoc63 / learningDS

Learning DS with Codecademy and Books
0 stars 0 forks source link

Select Rows with Logic #376

Open oldoc63 opened 1 year ago

oldoc63 commented 1 year ago

You can select a subset of a DataFrame by using logical statements:

df[df.MyColumnName == desired_column_value]

In Python == is how we test if a value is exactly equal to another value.

We can use other logical staments, such as:

oldoc63 commented 1 year ago

You can also combine multiple logical statements, as long as each statement is in parentheses.