Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Deal with Several Conditions | Explore Dataset
Introduction to Python for Data Analysis

book
Deal with Several Conditions

If you want to implement several conditions, you can do this easily.

  • If you want to check dataset for the first and second condition to be True, just use & statement:

DataFrame.loc[condition1 & condition2]

  • If you want to check dataset for the first or the second condition to be True, just use | statement:

DataFrame.loc[condition1 | condition2].

question-icon

Calculate the number of users who choose the 'week' or 'year' plan. You should work with the data that titled as df.

df = df.
___
[
___
== 'week'
___
df['plan']
___
___
]

Click or drag`n`drop items and fill in the blanks

dots
==
dots
loc
dots
'year'
dots
|
dots
&
dots
df['plan']

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 3. Hoofdstuk 14

Vraag AI

expand
ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

some-alt