non-ML MISC Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Syntax to flatten a list of lists (without using itertools)

A

reduce(lambda x,y: x+y, list_of_lists)

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

What is “floor division” and the syntax for doing it?

A

Like regular division, but rounds down to nearest whole number.
Example: 8 // 3 returns 2

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

Syntax to check whether a variable is of a particular type

A

isinstance(my_var, some_type)

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

What does .strip() do?

A

Removes leading and trailing spaces (including “\n”s)

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

What string method removes leading and trailing spaces (including “\n”s)?

A

.strip()

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

Syntax to stop printing when encounter a particular substring?

A

print(some_text, end=’ ‘)

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

Syntax to find first index of a substring within a string?

A

string.find(substring)

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

Syntax to find first appearance of a value within a list?

A

my_list.index(my_value, start_position)

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

What to use instead of .isnull() and .notnull()?

A

.isna() and .notna()

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

What is an ML model?

A

Simply a function that takes observations as inputs and outputs some kind of prediction (e.g., values of a DV) or other outcome (e.g., cluster labels)

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