Data Science Basics with Python
- 53Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
53 questions
- 1The tool that makes setting up a data science environment easier by packaging necessary libraries is called_____.
Hint
Think of a distribution that bundles Python and data science packages together.
Answer
Anaconda
- 2In Visual Studio Code, you can install the_____extension to get Jupyter notebook support along with intellisense and linting.
Hint
The extension that provides rich support for the Python language in VS Code.
Answer
Python
- 3To annotate a Jupyter notebook with explanatory text, you use_____cells.
Hint
This type of cell allows you to write formatted text, not code.
Answer
markdown
- 4In Python, a list is created using square brackets, and you can see its contents by using the_____function.
Hint
This built-in function outputs text or variables to the console.
Answer
print
- 5The Variable Explorer in VS Code shows the_____of a list or other objects in the current Python session.
Hint
It reveals the individual elements stored inside the variable.
Answer
items
- 6Unlike a list, multiplying a numpy array by a number performs_____arithmetic on each element.
Hint
Think of an operation that applies to each individual component separately.
Answer
element-wise
- 7To find the number of elements in a numpy array, you use the_____attribute.
Hint
This attribute returns a tuple representing the dimensions of the array.
Answer
shape
- 8In Python, array indices start at_____, so the first element is accessed with index 0.
Hint
The starting number for counting positions in a sequence.
Answer
0
- 9To compute the average of a numpy array, you use the_____method.
Hint
A common statistical measure for central tendency.
Answer
mean
- 10A 2D numpy array can be created by passing a list of lists to the_____function.
Hint
This function converts a Python list into a numpy array.
Answer
np.array
- 11To access the first item from the second array inside a 2D numpy array, you use indexing like_____.
Hint
Remember that indexing starts at 0, and the first index selects the row (sub-array), the second selects the element.
Answer
[1, 0]
- 12A pandas DataFrame is a tabular data structure that can be thought of as a_____.
Hint
It resembles a spreadsheet with rows and columns.
Answer
table
- 13To create a pandas DataFrame from a dictionary of arrays, you use the_____constructor.
Hint
The pandas library's primary data structure constructor.
Answer
pd.DataFrame
- 14To access a row by its integer position in a DataFrame, you use the_____method.
Hint
This method is label-based, but when using integer indices, it works for label-based access if the index is integer.
Answer
loc
- 15To get a specific column from a row using .loc, you pass the row label and the_____name as the second argument.
Hint
The vertical dimension in a DataFrame, which has a name.
Answer
column
- 16To filter rows in a DataFrame where a column equals a value, you use a boolean expression like df[_____].
Hint
This creates a boolean mask that selects rows where the condition is True.
Answer
df['name'] == 'Vicky'
- 17The DataFrame method that allows querying using a string expression is called_____.
Hint
This method accepts a query string similar to SQL.
Answer
query
- 18You can access a DataFrame column directly as an attribute if the column name is a valid Python identifier, like_____.
Hint
This uses dot notation to select a column.
Answer
df.grade
- 19To load a CSV file into a pandas DataFrame, you use the_____function.
Hint
This function reads comma-separated values into a DataFrame.
Answer
pd.read_csv
- 20The method .isnull() returns a DataFrame of the same shape with True where values are_____.
Hint
This indicates absent or not-a-number values.
Answer
missing
- 21To replace missing values with the mean of a column, you use the_____method.
Hint
This method fills in null entries with a specified value.
Answer
fillna
- 22To remove rows with any missing values, you use the_____method with axis=0.
Hint
This method drops rows (or columns) that contain null values.
Answer
dropna
- 23To add a new column to a DataFrame, you can use pd.concat with axis=_____, which concatenates along the column axis.
Hint
Axis 0 is for rows, axis 1 is for columns.
Answer
1
- 24The DataFrame method to group rows by a column and then compute aggregate statistics is_____.
Hint
This allows split-apply-combine operations.
Answer
groupby
- 25To sort a DataFrame by a column in ascending order, you use the_____method.
Hint
This method reorders rows based on column values.
Answer
sort_values
- 26To sort a DataFrame in descending order, set the parameter ascending to_____.
Hint
This boolean parameter controls the direction of sorting.
Answer
False
- 27The library commonly used for plotting in Python is_____.
Hint
This library provides a MATLAB-like plotting interface.
Answer
matplotlib
- 28To create a bar chart in matplotlib, you use the_____function.
Hint
This function draws vertical or horizontal bars.
Answer
bar
- 29To rotate x-axis labels in a matplotlib plot, you use the_____parameter in xticks.
Hint
This parameter takes an angle in degrees.
Answer
rotation
- 30In matplotlib, the entire window including the plot is called a_____.
Hint
This is the top-level container for all plot elements.
Answer
figure
- 31To set the size of a figure, you use the_____parameter in plt.figure() or when creating subplots.
Hint
This parameter takes a tuple (width, height) in inches.
Answer
figsize
- 32A figure containing multiple plots is created using the_____method.
Hint
This returns a figure and an array of axes.
Answer
subplots
- 33To create a pie chart from a pandas Series, you use the_____method on the axis.
Hint
This function draws a circular statistical graphic.
Answer
pie
- 34To create a histogram showing the distribution of data, you use the_____method.
Hint
This plot groups data into bins.
Answer
hist
- 35To add a vertical line to a plot at a specific x-value, you use the_____method.
Hint
This draws a vertical line across the axes.
Answer
axvline
- 36A box plot displays the distribution of data based on five-number summary: minimum, first quartile, median, third quartile, and_____.
Hint
This is the highest value in the data, excluding outliers.
Answer
maximum
- 37To create a scatter plot in matplotlib, you use the_____function.
Hint
This shows points without connecting lines.
Answer
scatter
- 38The value that occurs most frequently in a dataset is called the_____.
Hint
This is another measure of central tendency besides mean and median.
Answer
mode
- 39The middle value when data is sorted from lowest to highest is the_____.
Hint
This measure is resistant to outliers.
Answer
median
- 40The difference between the maximum and minimum values in a dataset is called the_____.
Hint
A simple measure of spread.
Answer
range
- 41The average of the squared differences from the mean is called the_____.
Hint
It measures how far the data points are spread out.
Answer
variance
- 42The square root of the variance is the_____.
Hint
This measure is in the same units as the data.
Answer
standard deviation
- 43In a normal distribution, approximately_____% of the data falls within one standard deviation of the mean.
Hint
This is the 'magic number' for the empirical rule.
Answer
68
- 44The .describe() method on a DataFrame returns summary statistics including mean, std, min, max, and_____.
Hint
These are the 25th, 50th, and 75th percentiles.
Answer
quartiles
- 45A correlation value close to 1 indicates a strong_____correlation between two variables.
Hint
As one variable increases, the other tends to increase.
Answer
positive
- 46The phrase 'correlation does not imply_____' warns against assuming a direct cause-and-effect relationship.
Hint
A relationship does not necessarily mean one causes the other.
Answer
causation
- 47To normalize features to a range between 0 and 1, you can use the_____scaler from scikit-learn.
Hint
This scaler transforms features by scaling each to a given range.
Answer
MinMaxScaler
- 48In linear regression, the equation of the line is y =_____x + b.
Hint
This letter represents the slope of the line.
Answer
m
- 49The method of finding the line of best fit by minimizing the sum of squared errors is called_____regression.
Hint
This is the most common method for linear regression.
Answer
ordinary least squares
- 50To compute the slope and intercept of a linear regression in Python, you can use the_____function from scipy.stats.
Hint
This function returns slope, intercept, r-value, p-value, and standard error.
Answer
linregress
- 51The difference between the actual y value and the predicted y value (from the regression line) is called the_____.
Hint
Also known as the residual.
Answer
error
- 52Using the slope and intercept from linear regression, you can predict a new y value by computing_____.
Hint
This is the equation of the line of best fit.
Answer
m * x + b
- 53To create a scatter plot with a regression line, you first plot the scatter data and then use the_____function to plot the line.
Hint
This function draws a line through the predicted y values.
Answer
plot

Ask anything
We've read this whole study set, so questions about it get the best answers.