Quantopian Flashcards
You can print lines you want with the word print
True
In python, what is pandas?
A library
If I gave numpy the alias “np”, and I imported some data and named it “sample”, how would I calculate the mean and standard deviation of the data using numpy?
np.mean(sample), np.std(sample)
In Quantopian’s IPython interface, what is one of the functions that can be used to pull some real price data?
get_pricing()
What is one of the functions that can be used to calculate returns?
pct_change()
If I wanted to calculate the 100 day moving average using daily data, I can use pandas built-in tools to do so. The data is loaded in and named “price_data”. Assuming I load in pandas with the alias “pd”, then what would be the correct way to write the function to calculate the 100 day moving average using pandas?
pd.rolling_mean(price_data, window=100)
If “”” This text is enclosed between the triple quotes “”” then it is referred to as
a string
13.198 is what type of variable in Python?
Float
What happens to the number 13.198 when I run the following code,
int(13.198)
Truncate any digits after the decimal point
What will running the following code in Python create?
[1, ‘This’, 3, ‘that’]
List
What can the colon symbol be used to slice in Python?
List
If I wanted to grab the last item from a list in Python, which line of code would I need to run? Assume the name of the list is defined as X.
X[-1]
You can change any part of a tuple because it is immutable.
False
If I have two different variables, X and Y, and I wanted to know if they are the same, I would run the following code
print (X == Y)
True
What are the two main components that make up a dictionary in Python?
Key and Value