Resources

Practice Exams

Exam Reference Guide

Staff Solutions

To access the solutions, click on the link below and you will be directed to a Google Drive Folder with all the available solutions. You need to be signed into your berkeley.edu email account to access the solutions.


Table Functions and Methods

Name Chapter Description
Table 5 Create an empty table, usually to extend with data
Table.read_table 5 Create a table from a data file
with_columns 5 Create a copy of a table with more columns
column 5 Create an array containing the elements of a column
num_rows 5 Compute the number of rows in a table
num_columns 5 Compute the number of columns in a table
labels 5 Lists the column labels in a table
select 5 Create a copy of a table with only some of the columns
drop 5 Create a copy of a table without some of the columns
relabel 5 Modifies the existing table in place, changing the column heading in the first argument to the second
relabeled 5 Returns a new table with the column heading in the first argument changed to the second
sort 5.1 Create a copy of a table sorted by the values in a column. Defaults to ascending order unless "descending = True" is included
where 5.2 Create a copy of a table with only the rows that match some predicate
take 5.2 Create a copy of the table with only the rows whose indices are in the given array
barh 6.1 Draws a bar chart of the frequencies of a categorical distribution
histogram 6.2 Draws a histogram of a numerical distribution
apply 7.1 Returns an array of a a function applied to some row in a table
group 7.2 Create a copy of the table with all rows with the same values in a certain column aggregated into one row in the new table
groups 7.3 Create a copy of the table with all rows with the same value in a certain array of columns aggregated into one row in the new table
pivot 7.3 Create a copy of the table with a column for each element in the first argument and a row for each element in the second argument and aggregates values
join 7.4 Create a copy of the table that is the result of joining the columns of two tables, with a row for each shared value in the two tables
sample 9 Draws some number of rows at random from a table. By default, with replacement.
proportion_from_distribution 10.1 Returns a new table with an additional column corresponding to proportions from a random sample of some size of the proportions in a column.


Array Functions and Methods

Name Chapter Description
max 3.3 Returns the maximum value of an array
min 3.3 Returns the minimum value of an array
sum 3.3 Returns the sum of the values in an array
len 3.3 Returns the length (number of elements) of an array
make_array 4.4 Makes a numpy array with the values passed in
np.average 4.4 Returns the mean value of an array
np.diff 4.4 Returns a new array of size len(arr)-1 with elements equal to the difference between adjacent elements
np.sqrt 4.4 Returns an array with the square root of each element
np.arange 4.5 Returns an array of an end-exclusive range of variable step size
arr.item 4.6 Returns the i-th item in an array (remember Python indices start at 0!)
np.random.choice 8 Picks one (by default) or some number 'n' of items from an array at random. By default, with replacement.
np.count_nonzero 8 Returns the number of non-zero (or True) elements in an array.
np.append 8.2 Returns a copy of the input array with some item (must be the same type as the other entries in the array) appended to the end.
percentile 11.1 Returns the corresponding percentile of an array.