Which Python library is primarily used for handling and analyzing structured data like tables?
Think about the library that works well with rows and columns, like a spreadsheet.
Pandas is designed for working with structured data in tables, making it easy to manipulate and analyze data.
What is the output of this code?
import numpy as np arr = np.array([1, 2, 3]) result = arr * 2 print(result.tolist())
Multiplying a NumPy array by a number multiplies each element.
NumPy arrays support element-wise operations, so each element is multiplied by 2.
You want to build a deep neural network with GPU support and easy model building. Which Python library is best suited?
Look for a library designed for deep learning and GPU acceleration.
TensorFlow is a popular deep learning library with GPU support and high-level APIs for building models.
Which metric from scikit-learn is best to evaluate a classification model's ability to balance precision and recall?
Think about a metric that combines precision and recall into one number.
F1 Score is the harmonic mean of precision and recall, useful for imbalanced classes.
What error does this code raise?
from sklearn.pipeline import Pipeline from sklearn.preprocessing import StandardScaler from sklearn.linear_model import LogisticRegression pipe = Pipeline([ ('scaler', StandardScaler()), ('clf', LogisticRegression()) ]) pipe.fit([[1, 2], [3, 4]], [0, 1])
Check if the number of samples in features and labels match.
The features and labels have matching sample counts, so the code runs without error.
