.loc Function
Pandas allows you to set specific conditions on the dataset without an if/else statement and loops. Look at the syntax:
DataFrame.loc[DataFrame['job_title'] == 'Data Scientist'].count()
So inside the .loc[]
function, you just put the condition you need. Here you compare if 'job_title'
is equal to 'Data Scientist'
.
It compares each value of 'job_title'
to the 'Data Scientist'
string.
The ways of creating such conditions are the same as for if
statements; you can use >
, <
, >=
, =<
, ==
with the same meaning.
To pick up a draggable item, press the space bar.
While dragging, use the arrow keys to move the item.
Press space again to drop the item in its new position, or press escape to cancel.
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 3. Kapitel 13
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal