Data Analysis Fundamentals · Getting started
20 cards
Core Pandas Vocabulary
-
Quick check
Which statement describes a Series?
AIt has two axes and stores a different kind of value on each of those two axes
Two axes make a DataFrame; a Series has one, and its values share a single type.
BIt has one axis whose labels are the column names taken from a wider table
The labels of a Series axis are its Index; column names belong to the second axis of a DataFrame.
CIt has one axis, its labels are the Index, and it holds one `dtype`
Right. One labeled axis called the Index, and one `dtype` for the values it stores.
3 / 20
-
Quick check
Which description of a DataFrame is accurate?
AA table whose rows are labeled by the Index and whose columns may hold different types
Right. The Index labels the rows, `columns` labels the columns, and column types may differ.
BA grid with one type for all of its cells and no labels on either of its two axes
A DataFrame labels both axes, and its columns are allowed to hold different data types.
CA one-dimensional sequence whose labels serve as its column names
That is a Series: one dimension, and its labels are an Index rather than column names.
6 / 20
-
Quick check
You build a Series from a plain list of five values and pass no index. What labels does it get?
AColumn labels copied straight from the five values that were in the list
Values and labels are different things; the values are not reused as labels.
BA RangeIndex running from 0 through 4
Right. Without an explicit index, pandas creates a default RangeIndex from zero to one less than the length.
CNone at all, because passing a list switches the Index off
Every Series has an Index; when you do not supply one, pandas creates it for you.
9 / 20
-
Keep your progress in the app
That’s 3 of 7 quick checks. In the app they stay answered, and every lesson remembers where you left off.
-
Quick check
A table has customer IDs as row labels and four named variables, each of a different type. You must check both axis lengths and the type of every variable. Which pair of checks does that?
A`dtype` for the axis lengths, and `index` for the variable types
`dtype` reports a single type rather than any dimension, and `index` returns row labels rather than types.
B`shape` for the axis lengths, and `dtypes` for the variable types
Right. `shape` reports the two axis lengths, and `dtypes` reports the type of each named column.
C`columns` for the row count, and `shape` for the type of each variable
`columns` returns the column labels, and `shape` reports lengths rather than types.
12 / 20
-
Quick check
You need one named variable across many labeled observations, and you must keep those row labels when you pull it out of a wider table. What should the selection give you?
AA Series holding just that variable, still labeled by the wider table's row Index
Right. Selecting one column narrows the table to one variable, and the Series keeps the DataFrame's row Index.
BA DataFrame that carries every one of the original variables along with it
Keeping every variable does not narrow the table to the one you need.
CA scalar whose single label is meant to stand for all the observations
A scalar is a single value and cannot represent many labeled observations.
15 / 20
-
Quick check
A downstream function needs a NumPy array, but your analysis also depends on the customer labels and on the per-column types. What is the trade-off in converting a mixed DataFrame?
AThe array keeps a separate type for each column and preserves every one of the pandas labels
A NumPy array has one type for the whole array, and the conversion does not carry labels.
BThe DataFrame collapses into one Series while keeping both of its labeled axes
Conversion produces an array, not a Series, and the labeled axes are exactly what is lost.
CThe array may fall back to a single common type, and both label axes are dropped
Right. Mixed columns may be coerced to a common type, and the row and column labels are omitted.
18 / 20
-
Quick check
Which summary of the vocabulary is correct?
AIndex labels the rows, `columns` labels the columns, and `shape` reports the two axis lengths
Right. Those three names cover row labels, column labels, and the size of the object.
B`shape` labels the rows, Index reports each column's type, and `columns` counts the stored values
`shape` reports lengths rather than labels, and the Index holds row labels rather than types.
C`dtypes` supplies the labels of both axes, while `shape` lists the type held by every column
`dtypes` reports column types, and `shape` reports the two axis lengths.
20 / 20
-
7 quick checks · then the test
In the app, finishing the quick checks opens this lesson’s 10-question test, and the ones you miss come back exactly when you’re about to forget them.
The whole course, on your phone
Lessons you can read, audio you can listen to on the way to work, and practice that remembers what you got wrong.