0% found this document useful (0 votes)
10 views6 pages

DataScience StudyGuide

This study guide covers essential topics in data science, including NumPy, Pandas, Matplotlib, statistics, clustering, and GitHub operations, with a focus on key functions and concepts. It outlines the exam format, providing 40 questions drawn from practice material and emphasizes mastering six sections. Additionally, it includes memory tricks and top exam tips to aid in preparation.

Uploaded by

lewisnick.ln8899
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views6 pages

DataScience StudyGuide

This study guide covers essential topics in data science, including NumPy, Pandas, Matplotlib, statistics, clustering, and GitHub operations, with a focus on key functions and concepts. It outlines the exam format, providing 40 questions drawn from practice material and emphasizes mastering six sections. Additionally, it includes memory tricks and top exam tips to aid in preparation.

Uploaded by

lewisnick.ln8899
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Data Science

Exam Study Guide

Pandas · Matplotlib · NumPy · Statistics · Clustering · GitHub

40 Questions · Quick Reference · Memory Tricks

■ EXAM FORMAT: 40 questions total — 20 from your 60 practice questions + 20 unseen. Master all 6 sections
below!

① NumPy — "Smart Lists for Math"


Think of NumPy arrays as Python lists that can do maths super fast.

Function What it does

[Link](5) Array of 5 zeros → [0,0,0,0,0]

[Link](5) Array of 5 ones → [1,1,1,1,1]

[Link](5, 7) Array of 5 sevens → [7,7,7,7,7]

[Link](0,10) Integers 0–9 (like range())

[Link](0,1,5) 5 evenly spaced values between 0 and 1

[Link](a) Copy array without linking to original

[Link](a) Sort array (ascending by default)

[Link](a,(2,3)) Change shape — same data, new layout

[Link]((a,b)) Stack vertically → adds ROWS

[Link]((a,b)) Stack horizontally → adds COLUMNS

[Link](a) Flip rows and columns

[Link](a) Running total: [1,2,3] → [1,3,6]

np.array_equal(a,b) True if both arrays are identical

■ Memory trick: vstack = Vertical = more Rows. hstack = Horizontal = more Columns.
② Pandas DataFrame — "Excel in Python"
A DataFrame is just a table with rows and columns. Every operation below works on that table.

Method / Function What it does

[Link]() Summary stats: mean, min, max, std, quartiles

[Link]() Delete ALL rows that contain any missing value

[Link](0) Fill missing values with 0 (or any value)

[Link](a, b) Replace every occurrence of a with b

df.reset_index() Reset row numbers back to 0, 1, 2 …

df.set_index("col") Use a column as the row label (index)

[Link]("col").mean() Group rows by col, then compute mean per group

df["new"] = df["a"]+df["b"] Add a new calculated column directly

[Link](new=...) Another way to add a new column (chainable)

[Link][row, col] Select by LABEL name

[Link][0, 1] Select by NUMBER position (row 0, col 1)

[Link](func) Apply a function to each row or column

df["col"].map(func) Apply a function to each CELL in one column

df["col"].value_counts() Count how many times each unique value appears

[Link](df1, df2) Join two DataFrames on a common key (SQL JOIN)

[Link]([df1,df2],axis=0) Stack DataFrames vertically (add rows)

[Link](df) Wide → Long: columns become rows

[Link]() Pivot innermost column level into row index

pd.pivot_table(df,...) Summarise like an Excel pivot table

■ loc vs iloc: loc = Label | iloc = Integer position

■ dropna REMOVES rows | fillna REPLACES missing values

■ merge = JOIN on key column | concat = just STACK tables


③ Matplotlib — "The Drawing Tool"
import [Link] as plt
fig, ax = [Link]() # Create figure + axes
[Link]() # Display the plot

Function / Parameter What it does

[Link]() Display / render the plot

[Link]("[Link]") Save plot to a file

[Link]() Create figure with one or more subplots

[Link]() Add background grid lines

[Link]() Draw a pie chart

[Link]() Draw a histogram

[Link](x=,y=) Scatter plot directly from a DataFrame

ax.set_title() Add a title to the axes

ax.set_xlim(a, b) Set x-axis visible range

ax.set_aspect("equal") Keep x and y scales proportional

ax.tick_params() Customise tick size, rotation, color

[Link]() Add annotation text with an arrow

[Link](x,y,"text") Add plain text at position (x,y)

ax.fill_between() Fill area between two curves

fig.set_size_inches() Change figure width and height

plt.tight_layout() Auto-fix spacing between subplots

subplots_adjust(wspace,hspace) Manually control subplot spacing

alpha=0.5 Transparency: 0=invisible, 1=fully solid

c=values Color scatter markers by data values

[Link]() Draw a box-and-whisker plot

④ Statistics — The 4 Moments + Distributions


The 4 Moments of a Distribution
Moment Name Simple meaning

1st Mean Average — the centre of the data

2nd Variance Spread — how far data sits from the mean

3rd Skewness Lean — left or right asymmetry

4th Kurtosis Tails — how heavy the extreme ends are

Key Distributions
Distribution Use case / Key idea

Normal Bell curve. Most natural real-world data.


Distribution Use case / Key idea

Uniform Every outcome equally likely (e.g. rolling a die).

Binomial Yes/No trials repeated n times. n = number of trials.

Poisson Count of events in a fixed time interval (calls/hour).

t-Distribution Like Normal but for SMALL sample sizes. Hypothesis testing.

Exponential Time between events.

■ Skewness: Positive → tail goes RIGHT (right-skewed) | Negative → tail goes LEFT (left-skewed)

■ Kurtosis of a Normal distribution = 3 (called Mesokurtic)


⑤ Fitting & Clustering Concepts
Fitting Clustering (K-Means)

Finding a mathematical line or curve that best describes Grouping data points that are similar — WITHOUT
your data points. • Linear fit = straight line through data • labels. • Choose K (number of clusters) • Algorithm
The goal is to minimise the error between the line and assigns each point to nearest centroid • Centroids move
actual points • Used in regression and prediction tasks until stable • Use Elbow Method to find best K

⑥ GitHub Operations — Version Control Basics


Command What it does

git init Start a brand new local repository

git clone Copy an existing repo to your machine

git add . Stage ALL changed files for commit

git commit -m "" Save a snapshot with a message

git push Upload your commits to GitHub

git pull Download latest changes from GitHub

git branch View or create branches

git merge Combine one branch into another

git status See which files have changed

git log View history of commits


■ Top Exam Tips — Read Before You Start
loc vs iloc loc = select by LABEL name | iloc = select by INTEGER position

dropna vs fillna dropna REMOVES rows with NaN | fillna REPLACES NaN with a value

merge vs concat merge = JOIN on a key column | concat = just STACK tables together

apply vs map apply works on DataFrame rows/columns | map works on Series elements

vstack vs hstack vstack → adds ROWS (vertical) | hstack → adds COLUMNS (horizontal)

Skewness sign Positive skew → right tail (right-skewed) | Negative → left tail

Kurtosis = 3 Normal distribution kurtosis = 3 = Mesokurtic

Poisson vs Binomial Poisson = events per time interval | Binomial = yes/no repeated n times

t-Distribution Use for hypothesis testing with SMALL sample sizes

alpha parameter Controls transparency in plots: 0 = invisible, 1 = solid

c parameter Colors scatter plot markers by data values

Unseen questions Read carefully — function names usually describe what they do!

Good luck tomorrow! You got this ■

You might also like