IBM Data Science Professional Certificate study materials
IBM Data Science Professional Certificate study resources

IBM Data Science Professional Certificate: Data Analysis with Python (NumPy, Pandas, Data Wrangling)

IBM Data Science Professional Certificate · Work through your exam, one topic at a time.

All guide sections

Data Analysis with Python (NumPy, Pandas, Data Wrangling)

Data Analysis with Python (NumPy, Pandas, Data Wrangling)

This domain tests loading, inspecting, cleaning, transforming, and summarizing tabular data with pandas, plus NumPy vectorization. Questions often hinge on label versus position indexing, missing-value handling, and merge behavior.

Core rules

  • A Series is labeled one-dimensional data; a DataFrame is two-dimensional with an index and columns.
  • .loc is label-based and inclusive; .iloc is position-based and stop-exclusive.
  • Prefer vectorized operations and groupby over iterrows.
  • Diagnose missingness before imputing; isna, dropna, and fillna are different choices, not equivalents.
  • groupby follows split-apply-combine; agg can return multiple statistics.
  • Merges use how='inner', 'left', 'right', or 'outer'; validate keys and row counts after merging.
  • Convert types deliberately with astype and pd.to_datetime.

Worked example

Compute revenue by region after filling missing prices with the median price for each product:

df['price'] = df['price'].fillna(df.groupby('product')['price'].transform('median'))
df['revenue'] = df['units'] * df['price']
out = df.groupby('region')['revenue'].agg(['sum', 'mean', 'count'])

Reasoning: transform('median') returns a Series aligned to the original rows, so assignment fills only missing values. A product-level median is more defensible than a global median when prices differ by product. The final agg produces one row per region with three statistics.

Traps

  • Chained assignment causing SettingWithCopyWarning or silent non-updates.
  • Assuming inplace=True always returns the modified object.
  • Merging on non-unique keys and inflating row counts.
  • Treating NaN as zero before checking why it is missing.
  • Forgetting that .iloc excludes the stop position.