Master Deck Flashcards
How are if statements structured in Python?
if (statement):
(ONE TAB INDENT)action
In JavaScript, maps are similar to objects but allow for __________.
Any data type as the key in the key-value pairs.
In JavaScript maps, the three main functions are _____.
.set(), .has(), .delete()
What is the inequality operator in Python?
!=
How do you copy a JavaScript object without simply referencing the original object?
const person2 = {…person1};
In JavaScript, you should use a map instead of an object when you need to maintain _________.
the order of your items
In JavaScript, how do you convert an object into a JSON?
JSON.stringify(object)
Given a JSON, how do you convert it into an object in JavaScript?
JSON.parse(‘json’)
What is the ‘and’ operator in Python?
and
The _______ JavaScript library has a bevy of tools for working with objects and arrays.
Lodash
What is the ‘or’ operator in Python?
or
Given two JavaScript objects, meatInventory and veggieInventory, how would you merge them into one object called ‘inventory’?
const inventory = {…meatInventory, …veggieInventory};
How can you test whether a variable called ‘names’ is an array in JavaScript?
Array.isArray(names)
this will return either a true or a false
What is the ‘not’ operator in Python?
‘not’
The ‘…’ operator in JavaScript is called the _____ operator.
spread
Given the list:
seq = [1, 2, 3, 4, 5]
create a ‘for’ statement in Python that prints each element in the list.
for x in seq:
indent)print(x
If a pandas DataFrame named df has a column named W, how do you retrive W from df?
df[‘W’]
Given a pandas DataFrame named df that contains two columns X and Y, how do you create a third column named Z where Z = X + Y?
df[‘Z’] = df[‘X’] + df[‘Y’]
Given a DataFrame named df, how do you retrieve the value at row X, column Y?
df[‘Y’][‘X’]
What are the two methods available for collecting rows or columns from pandas DataFrames?
.loc
.iloc
In the pandas programming library, what are the two main methods for dealing with missing data?
.dropna()
.fillna()
How can DataFrames be concatenated using pandas?
pd.concat()
What method is used to return all unique values from a pandas Series?
pd.Series().unique()
On the command line, what command returns your current working directory?
pwd
(self-closing)
tags