Given `df = pd.read_csv('sales.csv')`, which method returns the first 5 rows by default?
Pcad Pandas Basics
Question · Easy
Overfitting: I memorized the practice test
Short
Which Pandas function loads a CSV file from disk into a DataFrame?
Pcad Data Acquisition
What does `df.shape` return?
Tech Exam Prep Podcast
Listen on Spotify
Podcast
Which method gives summary statistics (mean, std, min, max, quartiles) for numeric columns?
Pcad Statistics
How do you select rows where the `age` column is greater than 30?
What is the difference between `df.loc[]` and `df.iloc[]`?
Question · Medium
Given `s = pd.Series([1, 2, 3, 4, 5], index=['a','b','c','d','e'])`, what does `s.iloc[1:3]` return?
Which method drops rows containing any NaN values?
Pcad Data Cleaning
How do you fill all NaN values in a numeric DataFrame with the column mean?
Which method removes duplicate rows from a DataFrame?
Given two DataFrames `customers` and `orders` both with a `customer_id` column, how do you perform an inner join on that column?
Pcad Pandas Merging
What does `df.groupby('region')['sales'].sum()` return?
Pcad Pandas Groupby
Which is the correct syntax for applying multiple aggregations to a single column in groupby?
What does `transform` do in a groupby?
Question · Hard
How do you reshape a DataFrame from long to wide format?
Pcad Pandas Reshaping
What does `pd.melt(df, id_vars=['date'], value_vars=['a','b','c'])` do?
Which NumPy function creates an array of evenly-spaced values from 0 to 9 inclusive?
Pcad Numpy Basics
What does `arr.shape` return for `arr = np.array([[1,2,3],[4,5,6]])`?
What does `arr.reshape(3, -1)` do for a 12-element array?
What is broadcasting in NumPy?
Pcad Numpy Broadcasting
Which call computes the column-wise mean of a 2D NumPy array `arr`?
Pcad Numpy Aggregation
What does `np.where(arr > 0, 1, -1)` return?
Pcad Numpy Operations
Which statement creates a Pandas datetime index from `df['date']` and sets it as the index?
Pcad Pandas Datetime
Given a DatetimeIndex, what does `df.resample('M').sum()` do?
Which `.dt` accessor extracts the day of week (0=Monday) from a datetime Series?
Which scikit-learn function splits arrays/matrices into train and test subsets?
Pcad Sklearn Pipeline
Which method does a scikit-learn estimator use to learn parameters from training data?
Which is the correct order of operations to standardize features before training a model?
In a binary classification problem with class imbalance (95% negative, 5% positive), which metric is most misleading?
Pcad Classification Metrics
What does `sklearn.metrics.confusion_matrix(y_true, y_pred)` return for binary classification?
For a regression model, which metric is the square root of the average squared residual?
Pcad Regression Metrics
What does `sklearn.linear_model.LinearRegression().fit(X, y).coef_` return?
Pcad Regression
What is the primary purpose of `KMeans` in scikit-learn?
Pcad Clustering
Which technique reduces dimensionality by projecting data onto orthogonal axes of maximum variance?
Pcad Dimensionality Reduction
What does `sklearn.model_selection.cross_val_score(model, X, y, cv=5)` do?
Pcad Model Validation
Which scikit-learn class searches over a hyperparameter grid using cross-validation?
Which Pandas method writes a DataFrame to a SQL database?
Pcad Sql Integration
Which is a parameterized SQL query (safe from SQL injection) using `sqlite3`?
Which Matplotlib call creates a histogram of data in array `x`?
Pcad Visualization Matplotlib
What does `seaborn.heatmap(corr, annot=True, cmap='coolwarm')` typically display?
Pcad Visualization Seaborn
Which is the typical purpose of a box plot in EDA?
Which Python statement opens a JSON file for reading?
What is the difference between `json.load()` and `json.loads()`?
Which is a try/except pattern for safely parsing user-supplied integers from a CSV column?
Which Pandas option returns a copy with a column renamed?
What does `df.dtypes` return?
Loading more…