</>
CodeLearn Pro
Start Learning Free β†’

Python DS

Intermediate

Data Science Β· Machine Learning Β· AI

Python is the #1 language for data science, machine learning, and AI. Libraries like NumPy, Pandas, Matplotlib and scikit-learn give you a complete toolkit β€” from raw data to trained model β€” with concise, readable code.

pandasnumpymatplotlibscikit-learnscipyseaborntensorflowpytorch
1B+/month
PyPI Downloads
#1 Language
StackOverflow #
50+
ML Libraries
15M+
Kaggle users
10M+
Jupyter users
1991
First release

The Process

Data Science Pipeline

Every data science project follows this 6-step flow. Python has libraries for each stage.

01
Data Collection
CSV, databases, APIs, web scraping, sensors
02
Data Cleaning
Handle missing values, duplicates, type errors
03
EDA
Explore distributions, correlations, outliers
04
Feature Engineering
Create, transform, encode, scale features
05
Model Training
Fit algorithms, tune hyperparameters, validate
06
Evaluation
Accuracy, precision, recall, AUC, RΒ², RMSE

Ecosystem

Core Libraries

NumPy
import numpy as np

N-dimensional arrays with vectorised math β€” the foundation everything else builds on.

Arrays, linear algebra, random numbers, Fourier transforms
pip install numpy
Pandas
import pandas as pd

DataFrame-based data manipulation and analysis β€” like Excel but with code.

Data loading, cleaning, merging, groupby, time series
pip install pandas
Matplotlib
import matplotlib.pyplot as plt

The foundational plotting library β€” full control over every chart element.

Line, bar, scatter, histogram, subplots, custom styling
pip install matplotlib
Seaborn
import seaborn as sns

Statistical visualisation on top of Matplotlib β€” beautiful charts with less code.

Heatmaps, pairplots, violin plots, categorical charts
pip install seaborn
scikit-learn
from sklearn.linear_model import LinearRegression

The standard machine learning library β€” dozens of algorithms, preprocessing, and evaluation tools.

Classification, regression, clustering, pipelines, grid search
pip install scikit-learn
SciPy
from scipy import stats

Scientific computing β€” statistics, optimisation, signal processing, linear algebra.

Hypothesis tests, curve fitting, FFT, sparse matrices
pip install scipy
πŸš€ Install everything at once
pip install numpy pandas matplotlib seaborn scikit-learn scipy jupyter

# Or with conda (recommended for DS):
conda create -n ds python=3.12
conda activate ds
conda install numpy pandas matplotlib seaborn scikit-learn scipy jupyter

Cheat Sheet

Quick Reference

Click any row to copy the syntax

ConceptSyntaxNotes
Create array
np.array([1,2,3])
From list
Zeros / ones
np.zeros((3,4)) np.ones((2,3))
Fill with 0 or 1
Range
np.arange(0, 10, 2) np.linspace(0,1,5)
Step / evenly spaced
Random
np.random.randn(3,3) np.random.randint(1,10)
Normal / integer
Shape / reshape
a.shape a.reshape(3,4)
Dimensions
Indexing / slicing
a[0] a[1:3] a[a > 5]
Boolean mask
Math ops
a + b a * b np.dot(a,b)
Elementwise + matrix multiply
Stats
a.mean() a.std() a.sum(axis=0)
Axis 0=cols, 1=rows

Ready to analyse data?

The full tutorial walks through 6 modules β€” NumPy arrays, Pandas DataFrames, data cleaning, visualisation, machine learning, and a complete end-to-end project.

The Story of Python for Data Science

Real history, real companies, and an honest look at where Python for Data Scienceshines and where it doesn't β€” not just a feature list.

πŸ•°οΈ

Where it came from

Python wasn't originally built for data science at all β€” that came later, driven by community-built libraries. NumPy (2006) brought fast numerical arrays to Python, pandas (2008, built by Wes McKinney at a hedge fund) added spreadsheet-like data manipulation, and by the mid-2010s this ecosystem had made Python the default language for data work almost by accident of good tooling.

🏒

How it’s actually used today

Netflix's recommendation algorithm, Spotify's Discover Weekly playlists, and most published academic machine learning research all run on this Python data stack β€” pandas for cleaning data, NumPy for numerical operations, and TensorFlow or PyTorch for the machine learning models themselves. It's also the standard toolkit taught in university data science courses worldwide.

βš–οΈ

Strengths & trade-offs

The ecosystem's biggest advantage is that pandas and NumPy are actually implemented in fast, compiled C code underneath β€” so despite Python's reputation for being slow, real data science workloads run efficiently because the heavy lifting happens outside plain Python. The trade-off is a real learning curve: pandas' syntax and mental model take genuine practice, separate from learning core Python itself.

🧭

What to learn next

SQL comes next for almost everyone doing real data work, since raw data usually lives in a database before it ever reaches pandas. From there, a specific direction β€” statistics and visualisation, or machine learning specifically β€” is where most people branch off.