2. Functions and packages Flashcards

1
Q

numbers = [1, 2, 3, 4, 5]

list(filter(lambda x: x % 2 == 0, numbers))

A

Filtert de even getallen

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

df_cloth.loc[:,’Shirt’:’Dress’]

A

Selecteren van kolommen ‘shirt’ en ‘dress’
.loc = selecteren op label

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

df_cloth.loc[‘Expensive’:’Hat’]=8.99

A

Prijs aanpassen van expensive hat via loc functie

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

‘Category’: [‘A’, ‘B’, ‘A’, ‘B’, ‘A’, ‘B’]
‘Value’: [10, 20, 30, 40, 50, 60]

df.groupby(‘Category’)[‘Value’].mean()

A

Groeperen op ‘Category’ en het gemiddelde van ‘Value’ berekenen

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

get_group(‘Cheap’)

A

De specifieke groep ‘cheap’ oproepen obv naam

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

df_cloth.iloc[0:2,1:3]

A

Selecteren van rijen 0-1 en kolommen 1-2
.iloc = selecteren op index

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

numbers = [1, 2, 3, 4, 5]
list(map(lambda x: x ** 2, numbers))

A

Berekent de kwadraten van de getallen

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

‘Category’: [‘A’, ‘B’, ‘A’, ‘B’, ‘A’, ‘B’]
‘Value’: [10, 20, 30, 40, 50, 60]

df.groupby(‘Category’)[‘Value’].agg([‘sum’, ‘mean’, ‘min’])

A

Groeperen op ‘Category’ en verschillende aggregatiefuncties toepassen

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

df.drop()

A

Verwijderen van rijen of kolommen

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

df.describe()

A

Basisstatistieken berekenen

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

df.sort_values(ascending=false)

A

Aflopend sorteren

How well did you know this?
1
Not at all
2
3
4
5
Perfectly