Python for data analysis

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/70

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 6:05 PM on 7/26/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

71 Terms

1
New cards

Munge / munging / wrangling

The overall process of manipulating unstructured and/or messy data into a structured or clean form

2
New cards

Pseudocode

A description of an algorithm or process that takes a code-like form while likely not being actual valid source code

3
New cards

Syntactic sugar

Programming syntax which does not add new features, but makes something more convenient or easier to type

4
New cards

Python object

Every number, string, data structure, function, class, module, and so on exists in the Python interpreter in its own "box" which is referred to as a Python object

5
New cards

Do Python statements need to be terminated by semicolons? Y/N

No, however, semicolons can be used to separate multiple statements on a single line

6
New cards

Symbol preceding a comment in Python

#

7
New cards

Method

An attached function that has access to the object's internal contents

8
New cards

Binding

Assignment is also referred to as binding, as we are binding a name to an object. Variable names that have been assigned may occasionally be referred to as bound variables.

9
New cards

Attribute

Other Python objects stored "inside" the object. Objects typically have both these and methods.

10
New cards

None

The Python "null" value (only one instance of the None object exists)

11
New cards

str

String type

12
New cards

Unicode

unicode string type

13
New cards

float

double-precision (64-bit) floating point number

14
New cards

bool

A True or False value

15
New cards

int

Signed integer with maximum value determined by the platform

16
New cards

long

Arbitrary precision signed integer. Large int values are automatically converted to long

17
New cards

T/F: Many people use Python for its powerful and flexible built-in string processing capabilities (you can write string literal using either single quotes or double quotes

True!

18
New cards

For multiline strings with line breaks, how many quotes do you use?

Three (triple quotes), either ''' or """

19
New cards

Break

Ends a loop

20
New cards

pass

No-op statement. Can be used in blocks where no action is to be taken. It is only required because Python uses whitespace to delimit blocks. Common to use pass as a placeholder in code while working on a new piece of functionality.

21
New cards

finally

Executes code regardless of whether the code in the 'try' block succeeds or not

22
New cards

ternary expression

Allows you to combine an 'if-else' block which produces a value into a single line or expression. Syntax: "value = true-expr if condition else fales-expr"

23
New cards

Immutable

The object cannot be changed after it is created

24
New cards

Mutable

The object can be changed after it is created

25
New cards

Tuple

One-dimensional, fixed-length, immutable sequence of Python objects

26
New cards

Foo

placeholder for a value that can change

27
New cards

count

counts the number of occurrences of a value (in a tuple or a list)

28
New cards

List

One-dimsensional, variable-length, mutable sequence of objects. Can be defined using square brackets [] or using the "list" type function

29
New cards

Append

Used to add an element to the end of a list

30
New cards

Insert

Used to insert an element at a specific location in a list. Insert is computationally expensive compared to "append" since references to subsequent elements need to be shifted internally to make room for the new element

31
New cards

Pop

removes and returns an element at a particular index; the inverse operation to "insert"

32
New cards

Remove

Remove an element by value, which locates the first such value specified and removes it from the list

33
New cards

In

Keyword used to check if a list contains a value. Returns true or false. Note that checking whether a list contains a value is a lot slower than dicts and sets as Python makes a linear scan across the values of the list, whereas the others (based on hash tables) can make the check in constant time.

34
New cards

Extend

Can append multiple elements to an already defined list.

Extend is comparatively a more efficient / less expensive operation than concatenation to a list, especially if building up a large list since, with concatenation, a new list must be created and the objects copied over.

35
New cards

len

short for length

36
New cards

Sort

Sorts a list in-place (i.e. without creating a new object). Has options including passing a secondary sort key, i.e. a function that produces a value to use to sort the objects such as sort(key=len)

37
New cards

Bisect

implements binary-search and insertion into a sorted list (must be sorted first)

38
New cards

bisect.bisect

finds the location in a list where an element should be inserted to keep it sorted

39
New cards

bisect.insort

Inserts an element into the location in a list that will keep it sorted

40
New cards

NumPy

Numerical Python

41
New cards

Array

Used to store multiple values in one single variable

42
New cards

Slice notation

Used to select sections of list-like types (arrays, tuples, NumPy arrays). Its basic form consists of start:stop passed to the indexing operator []

43
New cards

dict

Python data structure aka a hash map or associative array. It is a flexibly-sized collection of key-value pairs, where key and value are Python objects

44
New cards

hashability

Means a key in a key-value pair is immutable. It could be an object like a scalar type (int, float, string) or a tuple (all the objects in the tuple need to be immutable too).

45
New cards

enumerate

function that returns a sequence of (i, value) tuples

46
New cards

sorted

function that returns a new sorted list from the elements of any sequence

47
New cards

sorted(set('some value'))

trick to return a sorted list of the unique elements (rather than having duplicates) in a sequence

48
New cards

zip

function that "pairs" up the elements of a number of lists, tuples, or other sequences, to create a list of tuples. number of elements produced is determined by the shortest sequence.

49
New cards

reversed

iterates over the elements of a sequence in reverse order

50
New cards

set

unordered collection of unique elements

51
New cards

a.add(x)

add element x to the set a

52
New cards

a.remove(x)

remove element x from the set a

53
New cards

a.union(b)

operation to return all of the unique elements in a and b. alternate syntax = a | b

54
New cards

a.intersection(b)

operation to return all of the elements in both a and b. Alternate syntax = a & b

55
New cards

a.difference(b)

operation to return all of the elements in a that are not in b. Alternate syntax = a - b

56
New cards

a.symmetric_difference(b)

operation to return all of the elements in a or b but not both. Alternate syntax = a ^ b

57
New cards

a.issubset(b)

True if the elements of a are all contained in b

58
New cards

a.issuperset(b)

True if the elements of b are all contained in a

59
New cards

a.isdisjoint(b)

True if a and b have no elements in common

60
New cards

list comprehension

Allow you to concisely form a new list by filtering the elements of a collection and transforming the elements passing the filter in one concise expression. Basic form = [expr for val in collection if condition]

61
New cards

syntax of a dict comprehension

dict_comp = {key-expr : value-expr for value in collection if condition}

62
New cards

syntax of a set comprehension

{expr for value in collection if condition} ... same as syntax of a list comprehension except with curly brackets

63
New cards

def

keyword to declare (define) a function

64
New cards

return

keyword to return a function

65
New cards

Anonymous (lambda) functions

simple functions consisting of a single statement, the result of which is the return value. It's often clearer and requires less typing to pass a lambda function than to write out a full-out function declaration

66
New cards

lambda

keyword meaning you're declaring an anonymous function

67
New cards

closure

any dynamically-generated function returned by another function. The key property is that the returned function has access to the variables in the local namespace (e.g. your Python setup) where it was created

68
New cards

currying

deriving new functions from existing ones by partial argument application

69
New cards

iterator protocol

a generic way to make objects iterable. Having a consistent way to iterate over sequences, like objects in a list or lines in a file, is an important Python feature.

70
New cards

generator

a simple way to construct a new iterable object. returns a sequence of values lazily, pausing after each one until the next one is requested. uses the yield keyword instead of the return keyword in a function

71
New cards

itertools

a standard library module that has a collection of generators for many common data algorithms