🇮🇳 Data Science & Machine Learning · subject
Data Science & Machine Learning Data Manipulation with NumPy and Pandas Syllabus
The Data Manipulation with NumPy and Pandas syllabus for Data Science & Machine Learning in full: 4 chapters, 15 topics and 29 sub-topics, every one listed below, plus 51 Data Manipulation with NumPy and Pandas flashcards with answers.
Data Manipulation with NumPy and Pandas syllabus: all 4 chapters
Expand any chapter to see its topics and sub-topics.
-
Numerical Computing with NumPy
4 topics- ndarray Fundamentals
- Array creation and dtypes
- Shape, reshape and dimensions
- Indexing and Slicing
- Boolean and fancy indexing
- Vectorized Operations
- Broadcasting rules
- Universal functions
- Aggregation and Linear Algebra
- sum, mean, axis operations
- Matrix operations with np.linalg
- ndarray Fundamentals
-
Pandas Data Structures
3 topics- Series and DataFrame
- Creating from lists, dicts and arrays
- Index objects
- Data Selection
- loc and iloc
- Boolean filtering
- Reading and Writing Data
- CSV, Excel and SQL sources
- JSON and parquet
- Series and DataFrame
-
Data Wrangling
5 topics- Handling Missing Data
- isnull, dropna and fillna
- Interpolation
- Grouping and Aggregation
- groupby mechanics
- agg, transform and apply
- Merging and Joining
- merge, join and concat
- Join types
- Reshaping Data
- pivot and pivot_table
- melt, stack and unstack
- Time Series Handling
- Datetime indexing
- Resampling and rolling windows
- Handling Missing Data
-
Data Cleaning and Feature Preparation
3 topics- Duplicate and Outlier Treatment
- drop_duplicates
- Outlier detection with IQR
- Type Conversion and Mapping
- astype and map
- apply and applymap
- String and Categorical Cleaning
- str accessor methods
- Category dtype
- Duplicate and Outlier Treatment
Data Science & Machine Learning Data Manipulation with NumPy and Pandas flashcards — 51 questions with answers
What is a NumPy ndarray?
An N-dimensional, fixed-size array of homogeneous (same dtype) elements stored in contiguous memory, enabling fast vectorized operations.
What do the ndarray attributes ndim, shape, size, and dtype return?
ndim = number of dimensions; shape = tuple of sizes per dimension; size = total number of elements; dtype = data type of elements.
How do np.zeros, np.ones, and np.full differ?
np.zeros fills with 0, np.ones fills with 1, and np.full fills with a specified constant value, each for a given shape.
What is the difference between np.arange and np.linspace?
np.arange(start, stop, step) generates values by step (stop exclusive); np.linspace(start, stop, num) generates num evenly spaced values (stop inclusive by default).
Why is a NumPy array more memory- and speed-efficient than a Python list for numeric work?
It stores homogeneous data in contiguous memory and uses compiled, vectorized C operations, avoiding per-element Python object overhead and loop interpretation.
What does array broadcasting do in NumPy?
It lets arrays of different but compatible shapes be combined in arithmetic by virtually stretching dimensions of size 1 to match, without copying data.
State the broadcasting rule for two dimensions to be compatible.
Comparing shapes from the trailing dimension, two dimensions are compatible if they are equal or one of them is 1.
In NumPy, does basic slicing (e.g. a[1:4]) return a copy or a view?
A view — it shares memory with the original array, so modifying the slice modifies the original.
What is fancy (integer-array) indexing in NumPy and does it return a view or copy?
Indexing with an array/list of integer indices (e.g. a[[0,2,4]]); it always returns a copy, not a view.
How does boolean mask indexing work in NumPy, e.g. a[a > 5]?
A boolean array of the same shape selects elements where the mask is True, returning a 1-D copy of those elements.
What is a vectorized operation in NumPy?
Applying an operation to entire arrays at once via compiled loops instead of explicit Python for-loops, giving concise and fast element-wise computation.
What is a NumPy universal function (ufunc)? Give two examples.
A function that operates element-wise on arrays with broadcasting support, e.g. np.add and np.sqrt (also np.exp, np.sin).
What does the axis parameter control in NumPy aggregations like sum(axis=0) on a 2-D array?
axis=0 aggregates down the rows (collapsing rows, result per column); axis=1 aggregates across columns (result per row).
Which NumPy function computes the matrix (dot) product, and what operator is equivalent?
np.dot(A, B) computes the matrix product; the @ operator is equivalent for 2-D arrays.
What does np.linalg.inv compute and when does it fail?
It computes the inverse of a square matrix; it fails (raises LinAlgError) if the matrix is singular (non-invertible / determinant zero).
Name the NumPy functions for determinant and for eigenvalues/eigenvectors.
np.linalg.det for the determinant; np.linalg.eig for eigenvalues and eigenvectors.
What is a pandas Series?
A one-dimensional labeled array holding data of a single dtype, with an associated index for label-based access.
What is a pandas DataFrame?
A two-dimensional labeled, size-mutable tabular structure with rows (index) and columns, where each column is a Series that can have its own dtype.
What is the difference between .loc and .iloc in pandas?
.loc selects by label (index/column names, inclusive of endpoints); .iloc selects by integer position (endpoint exclusive).
What does df['col'] return versus df[['col']]?
df['col'] returns a Series (1-D); df[['col']] returns a DataFrame (one-column 2-D).
Show the other 31 Data Manipulation with NumPy and Pandas flashcards
How do you filter DataFrame rows using a boolean condition?
Pass a boolean Series as a mask, e.g. df[df['age'] > 30], which returns rows where the condition is True.
What does .at and .iat offer over .loc and .iloc?
.at (label) and .iat (integer position) access a single scalar value and are faster than .loc/.iloc for that purpose.
Which pandas functions read and write CSV files?
pd.read_csv() reads a CSV into a DataFrame; DataFrame.to_csv() writes it out.
What read_csv parameters control the header row and which column becomes the index?
header (row number used as column names) and index_col (column to use as the row index).
Name pandas functions to read Excel, JSON, and SQL data.
pd.read_excel(), pd.read_json(), and pd.read_sql() (or read_sql_query/read_sql_table).
How does pandas represent missing data, and which function detects it?
Missing values are represented as NaN (or NaT for datetimes / pd.NA); df.isna() (alias isnull()) returns a boolean mask of missing entries.
What is the difference between dropna() and fillna() in pandas?
dropna() removes rows/columns containing missing values; fillna() replaces missing values with a specified value or method.
What does the 'method' argument in fillna (ffill / bfill) do?
ffill (forward fill) propagates the last valid value forward; bfill (backward fill) propagates the next valid value backward.
In dropna(), what do axis=0 vs axis=1 and how='any' vs how='all' mean?
axis=0 drops rows, axis=1 drops columns; how='any' drops if any value is NaN, how='all' drops only if all values are NaN.
What is the split-apply-combine pattern in pandas groupby?
Split data into groups by key, apply a function (aggregate/transform/filter) to each group, then combine the results into a new structure.
What does df.groupby('col').agg() allow that a single aggregation does not?
It allows applying multiple and/or different aggregation functions to one or several columns at once (e.g. {'sales':'sum','price':'mean'}).
What is the difference between groupby transform and aggregate?
aggregate returns one value per group (reduced shape); transform returns a result the same shape as the input, broadcasting the group result back to each row.
What is a pandas pivot_table used for?
To reshape and summarize data by grouping on index and column keys and applying an aggregation function (default mean) to the values.
What are the four how options of pd.merge and what does each keep?
'inner' keeps only matching keys; 'left' keeps all left rows; 'right' keeps all right rows; 'outer' keeps all keys from both, filling missing with NaN.
What is the difference between pd.merge and pd.concat?
merge combines DataFrames on key columns/indexes (database-style join); concat stacks DataFrames along an axis (rows or columns) by alignment of the other axis.
What do the on, left_on, and right_on parameters of merge do?
on specifies a shared key column name; left_on/right_on specify differently named key columns in the left and right DataFrames to join on.
What is the difference between pivot and melt in pandas?
pivot reshapes long to wide (spreads unique values into columns); melt reshapes wide to long (unpivots columns into key-value rows).
What do stack() and unstack() do to a DataFrame?
stack() moves column labels into a (inner) row index level (wide to long); unstack() moves an index level into columns (long to wide).
What is a MultiIndex (hierarchical index) in pandas?
An index with multiple levels, allowing data to be indexed and grouped by combinations of keys across more than one dimension on an axis.
How do you convert a column of date strings to datetime in pandas?
Use pd.to_datetime(df['col']), which parses strings into datetime64 values enabling date operations.
What does the .dt accessor provide on a datetime Series?
Access to datetime components and methods, e.g. .dt.year, .dt.month, .dt.day, .dt.dayofweek, .dt.hour.
What does resample() do on a time-indexed DataFrame, and how does it differ from groupby?
resample() groups time-series data into regular time buckets (e.g. 'M', 'D') for downsampling/upsampling with aggregation; it is groupby specialized for time frequencies.
What is the difference between resampling downsampling and upsampling?
Downsampling reduces frequency by aggregating into larger bins (e.g. daily to monthly); upsampling increases frequency, creating finer bins that often need fill/interpolation.
How do you detect and remove duplicate rows in pandas?
df.duplicated() returns a boolean mask of duplicate rows; df.drop_duplicates() removes them (keep='first'/'last'/False controls which to retain).
What is the IQR method for detecting outliers?
Compute IQR = Q3 - Q1; values below Q1 - 1.5*IQR or above Q3 + 1.5*IQR are flagged as outliers.
What does the z-score method for outliers measure, and what threshold is common?
z = (x - mean) / std measures how many standard deviations a value is from the mean; |z| > 3 is a common outlier threshold.
How do you change a column's data type in pandas?
Use df['col'].astype(dtype), e.g. astype('int'), astype('float'), or astype('category').
What does the pandas map() method on a Series do?
It applies a function or maps values via a dict/Series element-wise to a Series, returning a new Series (useful for value substitution).
What is the difference between Series.apply, Series.map, and DataFrame.applymap?
Series.map maps/substitutes element-wise (dict or function); Series.apply applies a function element-wise; DataFrame.applymap applies a function element-wise across all DataFrame cells.
What does the .str accessor enable on a string Series, with two examples?
Vectorized string methods, e.g. df['name'].str.lower() and df['name'].str.strip() (also .contains, .replace, .split).
What is a pandas categorical dtype and why use it?
A dtype for columns with a limited set of repeated string/label values; it stores data as integer codes mapped to categories, saving memory and speeding up grouping/comparison.
Data Science & Machine Learning Data Manipulation with NumPy and Pandas FAQ
What is in the Data Science & Machine Learning Data Manipulation with NumPy and Pandas syllabus?
Data Science & Machine Learning Data Manipulation with NumPy and Pandas is split into 4 chapters: Numerical Computing with NumPy, Pandas Data Structures, Data Wrangling and Data Cleaning and Feature Preparation. Together they contain 15 topics and 29 sub-topics.
How many chapters are in Data Science & Machine Learning Data Manipulation with NumPy and Pandas?
4 chapters, containing 15 topics and 29 sub-topics. The largest chapter is Data Wrangling, with 5 topics.
Are there flashcards for Data Science & Machine Learning Data Manipulation with NumPy and Pandas?
Yes — a 51-card Data Manipulation with NumPy and Pandas deck, printed in full in the flashcards section of this page and available in the Examius app with spaced repetition. The free plan covers one exam of your choice, including its flashcards; Examius Pro, a one-time purchase, unlocks every other exam and deck.