Tools of the Trade
Data scientists rely on a small, well-tested toolkit: the Python language, a notebook to work in, and a handful of libraries for numbers, tables, charts and statistics. This page introduces each tool and shows you how to set them up.
Why Python?
Python is the most widely used language for data science. It is easy to read, free, and has a huge collection of data libraries built by a large community. R is another popular choice, especially among statisticians, and SQL is essential for pulling data out of databases. This series uses Python throughout.
Where to write your code
| Tool | What it is | Good for |
|---|---|---|
| JupyterLab / Jupyter Notebook | A browser-based notebook that mixes code, output, charts and notes | Exploring data step by step |
| Google Colab | A free, hosted notebook that runs in your browser on Google's computers | Learning on a low-spec laptop, or without installing anything |
| VS Code | A code editor that can also open notebooks with its Jupyter extension | Larger projects and scripts |
A notebook is made of cells. You run a cell with Shift + Enter and its output appears directly underneath. In a notebook, the value of the last line in a cell is displayed automatically, so df.head() on its own shows a neat table. In a normal .py script you must use print(). The examples in this series use print() so they work in both.
The core libraries
| Library | Used for | Usual import |
|---|---|---|
| NumPy | Fast arrays and maths on many numbers at once | import numpy as np |
| pandas | Tables of data (DataFrames): loading, cleaning, grouping | import pandas as pd |
| Matplotlib | Drawing charts of every kind | import matplotlib.pyplot as plt |
| seaborn | Attractive statistical charts built on Matplotlib | import seaborn as sns |
| SciPy | Statistics, probability distributions and scientific maths | from scipy import stats |
| scikit-learn | Machine learning models | from sklearn... import ... |
The short names np, pd, plt and sns are conventions that almost everyone uses, so code you find online will be easy to follow.
Installing the toolkit
If you already have Python installed (see Installing Python & VS Code), create a virtual environment for your data projects and install the libraries with pip. The pip & Virtual Environments page explains these commands in detail.
python -m venv ds-env # Windows: ds-env\Scripts\activate # macOS / Linux: source ds-env/bin/activate python -m pip install numpy pandas matplotlib seaborn scipy jupyterlab openpyxl jupyter lab
The last command opens JupyterLab in your browser. openpyxl is the extra package pandas needs to read and write Excel files.
On Google Colab, NumPy, pandas, Matplotlib, seaborn and SciPy are already installed. Open colab.research.google.com, create a new notebook and start typing. It is a good option if your laptop is old or short on storage.
Another route is the Anaconda distribution, a single download that bundles Python, Jupyter and most data libraries. It is large but convenient if you prefer not to install packages one by one.
Checking your setup
import numpy as np import pandas as pd print(np.__version__) print(pd.__version__)
Your version numbers will probably differ. What matters is that NumPy starts with 2 and pandas with 2 (or later), because this series uses their current features.
Never name your own file pandas.py, numpy.py or seaborn.py. Python will import your file instead of the real library, and you will get confusing errors such as AttributeError: module 'pandas' has no attribute 'DataFrame'. Rename the file (and delete any __pycache__ folder next to it).
Other tools you'll meet
- Excel and Google Sheets: still everywhere in business, and a common source of data files.
- SQL: the language for querying databases; many analysts use it daily.
- Power BI, Tableau and Looker Studio: dashboard tools for sharing results with non-programmers.
- Git and GitHub: version control for your code and a place to show your portfolio projects.
- Kaggle: a website with free datasets and notebooks for practice.
Key points
- Python plus a notebook (JupyterLab or Colab) is the standard starting setup.
- NumPy handles arrays, pandas handles tables, Matplotlib and seaborn draw charts, and SciPy does statistics.
- Use the conventional aliases
np,pd,pltandsns. - Install libraries inside a virtual environment, and never name your files after them.
Tip: use the ← and → keys to move between pages.
