ML4T EXAM 1 QUESTIONS WITH VERIFIED
ACCURATE ANSWERS 2026
Header rows of a CSV should represent what type of data? - Answers -Data that
changes over time.
What is PEAK data? - Answers -Real stock data (formally known as HCP) from Yahoo
Finance.
Define "Close" for stock data. - Answers -The actual price that was recorded at the
exchange for that day.
Define "Adjusted Close" for stock data. - Answers -A number provided by the data
provider, adjusted for stock splits and dividend payments.
When will "Close" and "Adjusted Close" data be the same? - Answers -For the current
day of data, we see these start to differ as we go back in time.
Who (and where) created the Pandas library? - Answers -Wes McKinney at AQR
(hedge fund).
What is a key component of Pandas? - Answers -The dataframe.
What function can be implemented from Pandas to read a CSV? - Answers -
pd.read_csv("csv")
How do you print the first five rows of a Pandas Dataframe? - Answers -By using the
df.head() function.
How do you print the last five rows of a Pandas Dataframe? - Answers -By using the
df.tail() function.
How would you get the rows between 10 and 20 for a Pandas Dataframe? - Answers -
df[10:21]
What is the operation called for returning a subset of the rows from a Pandas
Dataframe? - Answers -Slicing.
What function would you use to get the maximum value of a column in a Pandas
Dataframe? - Answers -df['Column Name'].max()
What function would you use to get the mean value of a column in a Pandas
Dataframe? - Answers -df['Column Name'].mean()
,What library is used to plot data from a Pandas Dataframe? - Answers -
matplotlib.pyplot
How would you use pyplot to plot data from a Pandas Dataframe? - Answers -Use
.plot() on the columns you are interested in plotting (like df['Adj Close'].plot()) and then
calling plt.show()
What is one method you would use to plot two columns simultaneously from a Pandas
Dataframe? (Assume we're plotting 'Close' and 'Adj Close') - Answers -df[[['Close', 'Adj
Close']]].plot(), plt.show()
How many days are typically traded at the NYSE? - Answers -252 days.
What reference symbol is good to use to determine if there was trading on a given day?
- Answers -SPY.
How would you create an empty dataframe indexed on a start and end date? - Answers
-dates = pd.date_range(start_date, end_date), df = pd.DataFrame(index=dates)
What type of join is performed by default when calling df.join(some_dataframe)? -
Answers -A left join.
When using a join function between dataframe a and dataframe b in the following format
df_a.join(df_b), what happens to the rows not present in b when joined with a? -
Answers -Pandas will fill these absent values with nan.
How do you join two DataFrames (df_1 and df_2)? - Answers -df_1.join(df_2)
How would you drop the rows in a DataFrame that contain nan? - Answers -df.dropna()
How could you join two DataFrames and drop nan values in a single line? - Answers -
df_1.join(df_2, how='inner')
How would you tell Pandas to index a DataFrame on dates when reading in a CSV? -
Answers -pd.read_csv(csv, index_col='Date')
How would you rename a column in a DataFrame? - Answers -df =
df.rename(columns={'old name' : 'new name'})
How would you look at a subset of rows and columns in a DataFrame? - Answers -
df[start_row:end_row + 1, start_col:end_col + 1]
How would you look at a subset of a DataFrame based on it's index? - Answers -
df.loc[date_1:date_2]
, How would you normailze stock data in a DataFrame? - Answers -Divide the dataframe
by it's first row: df1=df1/df1[0]
What is the output of the .plot function in df.plot()? - Answers -An axis handler.
How would you label the x and y axis if you had the following: ax = df.plot(title=title)? -
Answers -ax.set_xlabel('x label') and ax.set_ylabel('y label')
What makes numpy fast? - Answers -It is a wrapper around underlying c and fortran
code.
What does numpy call matrices? - Answers -ndarrays.
What does numpy focus on? - Answers -Matrices.
How is Pandas related to numpy? - Answers -Pandas is like a wrapper for numpy.
How would you extract an ndarray from a Pandas DataFrame? - Answers -nd_array =
df.values
Can you treat a DataFrame like an ndarray? - Answers -Yes.
What is one benefit of creating a DataFrame over an ndarray? - Answers -You get
many more routines.
What types of data does np.array() accept? - Answers -A list, a tuple, or a sequence.
How would you create a 2d array from a list of lists using the array function? - Answers
-By passing the list of lists to the array constructor: np.array([[1, 2, 3], [4, 5, 6]])
How would you create an empty numpy array of size 5? - Answers -np.empty(5)
How would you create an empty 2d numpy array with 5 rows and 4 columns? -
Answers -np.empty((5, 4))
How do you add additional dimensions to the construction of a np array? - Answers -
Add additional values to the sequence passed to np.empty for each dimension
How would you create an np array filled with ones? - Answers -np.ones((size))
How do you specify the datatype in a np array when creating it? - Answers -dtype =
type
How would you create a numpy array with 5 rows and 4 columns with random values? -
Answers -np.random.random((5, 4))
ACCURATE ANSWERS 2026
Header rows of a CSV should represent what type of data? - Answers -Data that
changes over time.
What is PEAK data? - Answers -Real stock data (formally known as HCP) from Yahoo
Finance.
Define "Close" for stock data. - Answers -The actual price that was recorded at the
exchange for that day.
Define "Adjusted Close" for stock data. - Answers -A number provided by the data
provider, adjusted for stock splits and dividend payments.
When will "Close" and "Adjusted Close" data be the same? - Answers -For the current
day of data, we see these start to differ as we go back in time.
Who (and where) created the Pandas library? - Answers -Wes McKinney at AQR
(hedge fund).
What is a key component of Pandas? - Answers -The dataframe.
What function can be implemented from Pandas to read a CSV? - Answers -
pd.read_csv("csv")
How do you print the first five rows of a Pandas Dataframe? - Answers -By using the
df.head() function.
How do you print the last five rows of a Pandas Dataframe? - Answers -By using the
df.tail() function.
How would you get the rows between 10 and 20 for a Pandas Dataframe? - Answers -
df[10:21]
What is the operation called for returning a subset of the rows from a Pandas
Dataframe? - Answers -Slicing.
What function would you use to get the maximum value of a column in a Pandas
Dataframe? - Answers -df['Column Name'].max()
What function would you use to get the mean value of a column in a Pandas
Dataframe? - Answers -df['Column Name'].mean()
,What library is used to plot data from a Pandas Dataframe? - Answers -
matplotlib.pyplot
How would you use pyplot to plot data from a Pandas Dataframe? - Answers -Use
.plot() on the columns you are interested in plotting (like df['Adj Close'].plot()) and then
calling plt.show()
What is one method you would use to plot two columns simultaneously from a Pandas
Dataframe? (Assume we're plotting 'Close' and 'Adj Close') - Answers -df[[['Close', 'Adj
Close']]].plot(), plt.show()
How many days are typically traded at the NYSE? - Answers -252 days.
What reference symbol is good to use to determine if there was trading on a given day?
- Answers -SPY.
How would you create an empty dataframe indexed on a start and end date? - Answers
-dates = pd.date_range(start_date, end_date), df = pd.DataFrame(index=dates)
What type of join is performed by default when calling df.join(some_dataframe)? -
Answers -A left join.
When using a join function between dataframe a and dataframe b in the following format
df_a.join(df_b), what happens to the rows not present in b when joined with a? -
Answers -Pandas will fill these absent values with nan.
How do you join two DataFrames (df_1 and df_2)? - Answers -df_1.join(df_2)
How would you drop the rows in a DataFrame that contain nan? - Answers -df.dropna()
How could you join two DataFrames and drop nan values in a single line? - Answers -
df_1.join(df_2, how='inner')
How would you tell Pandas to index a DataFrame on dates when reading in a CSV? -
Answers -pd.read_csv(csv, index_col='Date')
How would you rename a column in a DataFrame? - Answers -df =
df.rename(columns={'old name' : 'new name'})
How would you look at a subset of rows and columns in a DataFrame? - Answers -
df[start_row:end_row + 1, start_col:end_col + 1]
How would you look at a subset of a DataFrame based on it's index? - Answers -
df.loc[date_1:date_2]
, How would you normailze stock data in a DataFrame? - Answers -Divide the dataframe
by it's first row: df1=df1/df1[0]
What is the output of the .plot function in df.plot()? - Answers -An axis handler.
How would you label the x and y axis if you had the following: ax = df.plot(title=title)? -
Answers -ax.set_xlabel('x label') and ax.set_ylabel('y label')
What makes numpy fast? - Answers -It is a wrapper around underlying c and fortran
code.
What does numpy call matrices? - Answers -ndarrays.
What does numpy focus on? - Answers -Matrices.
How is Pandas related to numpy? - Answers -Pandas is like a wrapper for numpy.
How would you extract an ndarray from a Pandas DataFrame? - Answers -nd_array =
df.values
Can you treat a DataFrame like an ndarray? - Answers -Yes.
What is one benefit of creating a DataFrame over an ndarray? - Answers -You get
many more routines.
What types of data does np.array() accept? - Answers -A list, a tuple, or a sequence.
How would you create a 2d array from a list of lists using the array function? - Answers
-By passing the list of lists to the array constructor: np.array([[1, 2, 3], [4, 5, 6]])
How would you create an empty numpy array of size 5? - Answers -np.empty(5)
How would you create an empty 2d numpy array with 5 rows and 4 columns? -
Answers -np.empty((5, 4))
How do you add additional dimensions to the construction of a np array? - Answers -
Add additional values to the sequence passed to np.empty for each dimension
How would you create an np array filled with ones? - Answers -np.ones((size))
How do you specify the datatype in a np array when creating it? - Answers -dtype =
type
How would you create a numpy array with 5 rows and 4 columns with random values? -
Answers -np.random.random((5, 4))