1/101
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
A generator function uses yield to yield a potentially infinite sequence of values rather than using return once.
True
s = "orange is the new blue"; s.replace("orange", "blue")
"blue is the new blue"
Any function in Python with no return value is actually returning what?
None
L = [2, 3, 5, 7, 11]; L[0:3]
[2, 3, 5]
s = "orange is the new blue"; s.partition(" ")
("orange", " ", "is the new blue")
Compared to lists, the main distinguishing feature of tuples is that they are what?
immutable
In Python every statement must end with a semicolon (;).
False
Strings in Python are created with single or double quotes.
True
a = [1, 2, 3]; b = [5, 7, 9]; a == b
False
result = (4 < 1); result
False
Python arithmetic has limited precision.
False
What statement is used for testing truth in and third-party modules?
import
Loops in Python are a way to repeatedly execute some code statement.
True
System refers to what?
the documentation of the program
numbers = ["one", "two", "three"]; numbers[0] = "four"; numbers
["four", "two", "three"]
L = [0, 1, 2, 7, 11]; L[-1]
11
To check if x is between 15 and 30 in Python, use what expression?
x > 15 and x < 30
In Python, indented code blocks are always preceded by a colon on the previous line.
True
Which one of the following is a generator expression?
(val for val in line)
def add(x, y): z = x + y; return z. How many arguments does add take?
2
L = [2, 5, 1, 0, 3, 4]; L.sort(); L
[0, 1, 2, 3, 4, 5]
a = [1, 2, 3]; b = [1, 2, 3]; a == b
True
if x is 15 < x < 30, then what condition should be used?
x > 15 and x < 30
The Index object follows many conventions used by Python built-in set data structure.
True
indA = pd.Index([1, 3, 5, 7, 9]); indB = pd.Index([2, 3, 5, 7, 11]); indA & indB / intersection
Int64Index([3, 5, 7], dtype="int64")
indA = pd.Index([1, 3, 5, 7, 9]); indB = pd.Index([2, 3, 5, 7, 11]); indA | indB / union
Int64Index([1, 2, 3, 5, 7, 9, 11], dtype="int64")
A Pandas Series is a one-dimensional array of indexed data.
True
A DataFrame is an analog of a two-dimensional array with flexible row indices and flexible column names.
True
Unlike a dictionary, the Series supports array-style operations such as slicing.
True
The index of a Series object should be an integer.
False
Like a dictionary, the Series object provides a mapping from a collection of keys to a collection of values.
True
For data = pd.Series([0.25, 0.5, 0.75, 1.0], index=["a", "b", "c", "d"]), data["a"]
0.25
For data = pd.Series([0.25, 0.5, 0.75, 1.0], index=["a", "b", "c", "d"]), data[1]
0.50
For data = pd.Series(["a", "b", "c"], index=[1, 3, 5]), data[1]
"a"
For data = pd.Series(["a", "b", "c"], index=[1, 3, 5]), data.iloc[1]
"b"
To get states with more than 20 million inhabitants from a DataFrame with pop column, use what?
data["pop"] > 20000000
What are the two special sentinels that can indicate a missing value?
None and NaN
Which Pandas function returns a copy of the data with missing values filled or imputed?
fillna()
Which Pandas function returns a filtered version of the data by dropping missing values?
dropna()
What function can fill each NA value using the previous value in the DataFrame?
data.fillna(method="ffill")
To fill NA entries in a DataFrame data with a single value, such as zero, use what?
data.fillna(0)
Real-world data is rarely clean and homogeneous.
True
What method converts a multiply indexed Series into a conventionally indexed DataFrame?
unstack()
A multi-indexed Series can be converted to a DataFrame.
True
Pandas allows MultiIndex for columns.
True
A MultiIndex can be used to represent data of more than two dimensions in a Series.
True
A multi-index can represent two-dimensional data within a one-dimensional Series.
True
Concatenating two DataFrames can result in duplicate index values.
True
Pandas includes functions and methods that make combining and joining data from multiple sources fast and straightforward.
True
When concatenating two DataFrames, to restrict the result to common columns, use which option?
join="inner"
ser1 = pd.Series(["A", "B", "C"], index=[1, 2, 3]); ser2 = pd.Series(["D", "E", "F"], index=[1, 2, 3]); pd.concat([ser1, ser2])
1 A; 2 B; 3 C; 1 D; 2 E; 3 F
Pandas only supports inner joins.
False
One essential feature of Pandas is high-performance, in-memory join and merge operations.
True
By default, pd.merge() uses common columns across the DataFrames to join.
True
By default, pd.merge() discards the index.
True
Using Pandas, we can manipulate data using relational algebra like relational databases.
True
The pd.merge() function implements one-to-one, many-to-one, and many-to-many joins.
True
A handy Pandas function to calculate descriptive statistics for all columns in a DataFrame is what?
describe()
To aggregate data in Pandas, use what function?
groupby
An essential piece of analysis of large data is efficient summarization by computing aggregations like sum(), mean(), median(), min(), and max().
True
The three steps in a groupby operation are what?
split, apply, combine
It is possible to define custom aggregations in Pandas.
True
To convert a column of string values to multiple columns of numerical values, use which method?
get_dummies() method
Slicing is not allowed in Pandas vectorized string operations.
False
Regular expressions are supported in Pandas vectorized string operations.
True
One advantage of Pandas vectorized strings compared to built-in string methods is what?
graciously handling missing values
Nearly all Python built-in string methods are mirrored by a Pandas vectorized string method.
True
Time deltas reference what?
an exact length of time
To compute aggregate values of time Series over time, use which function?
rolling()
Time stamps reference what?
particular moments in time
The difference between time intervals and periods is what?
Periods usually reference a special case of time intervals in which each interval is of uniform length and does not overlap.
The difference between shift() and tshift() is what?
shift() shifts the data, while tshift() shifts the index
The difference between two Timestamp values is what type?
Timedelta
To create a Timestamp object from the string "May 18 2019", use what?
pd.to_datetime("May 18 2019")
When resampling a time series, the primary difference between resample() and asfreq() is what?
resample() is fundamentally a data aggregation, while asfreq() is fundamentally a data selection
One of the most common problems with REST is what?
overfetching data from the server
Which attribute extracts the response content as a string?
text
JSON encodes complex data by combining what?
lists, dictionaries, strings, and numbers
When a request is sent, whether it was successful is inside which property?
status_code
To convert a Python object to a JSON string, use what?
json.dumps(object)
REST API allows sophisticated queries against the data in the server.
False
Which status code indicates the request was successful and data was returned?
200
Which status code indicates the resource was not found?
404
Which requests function obtains data from a server?
GET
API stands for what?
Application Programming Interface
GraphQL allows for writing a data schema that defines how a client can access the data.
True
Which HTTP method is used to retrieve a specified resource from the Web?
GET
XQUERY and XPATH are incompatible.
False
XQuery is built on XPath expressions.
True
The structure of an XML document is specified with nested attributes.
False
XML stands for what?
Extensible Markup Language
In an XML document, the top-level element is called what?
root
XQuery for XML is like SQL for databases.
True
The code "for $x in doc("books.xml")/bookstore/book where $x/price>30 order by $x/title return $x/title" is an example of what?
an XQUERY query
XML organizes data in what kind of structure?
hierarchical tree-like structure
Which is not designed to process XML documents: XQUERY, ElementTree, SQL, or XPATH?
SQL
HTML tag classes and ids are used for what?
used by CSS to determine which HTML elements to apply certain styles to
When two tags are nested within the same parent tag, they are an example of what relationship?
sibling
Which Python package is used to parse an HTML document?
BeautifulSoup
HTML tags can be nested within other tags.
True