#1 India's Top IT Training Institute

On Demand Courses

9 programs

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →

Python NumPy for Data Analysis
PDF Downloads

Download the NumPy for data analysis guide PDF from Uncodemy: arrays, vectorisation, broadcasting and statistics with runnable examples.

Prepared by: Uncodemy trainer team Reviewed by: Uncodemy Last reviewed: 27 Oct 2026
What the Guide Covers
1
Arrays and indexingCreate, slice and filter ndarrays.
2
Vectorised operationsWhole-array maths with no loops.
3
BroadcastingCombine arrays of different shapes.
4
Statistics and axisMean, median, std (ddof) by row or column.
5
Random numbersSeeded simulations you can repeat.

Quick Answer

This page offers Uncodemy's NumPy data analysis guide as a PDF download. NumPy provides fast arrays and vectorised mathematics, and it sits underneath pandas and many other analysis libraries. The guide covers arrays, indexing, vectorised operations, broadcasting, statistics and random numbers, with small examples you can run as they are.

Download

Python NumPy for Data Analysis PDF

Download the guide below. Each download is its own file, and everything in it is also explained on this page.

1 PDF Available
PDF 01 Main Guide

Python NumPy for Data Analysis

Arrays and indexing, vectorised operations, broadcasting, descriptive statistics with the axis argument, random numbers for simulation, and common mistakes, with small runnable examples.

PDF Free Oct 2026
Download PDF

A short form asks for your details before the download starts. Your details are used only to share study material and course information.

01

Why NumPy matters

NumPy supplies the ndarray, a grid of values of one type stored compactly in memory. Because operations run over whole arrays in optimised compiled code, they are far faster than Python loops, and the code is shorter and easier to read. Almost every Python data library is built on NumPy arrays, including pandas, SciPy and scikit-learn.

As an analyst you may use NumPy directly for numeric calculations, simulation and statistics, and you will meet it indirectly every time you use pandas. Understanding it helps you write faster code and understand the behaviour of the tools built on top of it.

02

Creating arrays

Arrays can be built from lists or generated with helper functions.

import numpy as np

a = np.array([12, 15, 11, 18, 20, 14])
zeros = np.zeros(3)
steps = np.arange(0, 10, 2)       # 0, 2, 4, 6, 8
grid = np.linspace(0, 1, 5)       # 5 evenly spaced values
matrix = np.array([[1, 2, 3], [4, 5, 6]])

print(a.shape, a.dtype, matrix.shape)
03

Vectorised operations

Arithmetic applies to every element at once; there is no need for a loop.

prices = np.array([100.0, 250.0, 80.0, 400.0])
qty = np.array([3, 1, 5, 2])

revenue = prices * qty             # element by element
print(revenue)                     # [300. 250. 400. 800.]
print(revenue.sum(), revenue.mean())
print((revenue > 300))             # boolean array
print(revenue[revenue > 300])      # boolean filtering
04

Indexing and slicing at a glance

GoalSyntaxMeaning
One elementa[2]Third element (indexing starts at 0)
A rangea[1:4]Elements 1, 2 and 3
From the enda[-2:]The last two elements
A row of a matrixm[0, :]First row, all columns
A column of a matrixm[:, 1]All rows, second column
By conditiona[a > 15]Elements greater than 15
05

Statistics with NumPy

NumPy includes the descriptive statistics that analysts use every day: mean, median, standard deviation, variance, minimum, maximum and percentiles. For two-dimensional arrays you can specify an axis so that the calculation runs down columns or across rows.

Remember that the default standard deviation in NumPy is the population version; set ddof to 1 for the sample standard deviation, which is what most analysis uses. It is a small detail that explains why two tools sometimes disagree in the third decimal place.

06

Descriptive statistics and the axis argument

Column-wise and row-wise summaries of a small matrix of monthly sales for three products.

sales = np.array([[120, 135, 150],
                  [ 90,  85, 100],
                  [200, 210, 190]])   # rows = products, columns = months

print(sales.sum(axis=0))              # total per month
print(sales.mean(axis=1))             # average per product
print(np.median(sales), np.percentile(sales, 90))
print(sales.std(ddof=1))              # sample standard deviation
07

Broadcasting

Broadcasting lets NumPy combine arrays of different shapes by stretching the smaller one along the missing dimension, without copying data. Adding a single number to an array is the simple case. A more useful case is subtracting each column's mean from a matrix to centre the data, or dividing each row by its total to get shares.

The rule is that dimensions are compared from the right and must be equal or one of them must be one. When shapes do not fit you receive a clear error that tells you the shapes, which is the signal to reshape or add an axis.

08

Broadcasting examples

Centre each column and turn each row into percentage shares.

centered = sales - sales.mean(axis=0)                  # subtract column means
shares = sales / sales.sum(axis=1, keepdims=True)      # row shares

print(centered.round(1))
print((shares * 100).round(1))
09

Random numbers for simulation

A seeded generator gives repeatable results, useful for testing ideas such as a simple simulation of daily orders.

rng = np.random.default_rng(seed=42)
daily_orders = rng.poisson(lam=20, size=30)    # 30 days, average 20 orders

print(daily_orders.mean(), daily_orders.std(ddof=1))
10

NumPy and pandas together

  • A pandas column is backed by a NumPy array; df['x'].to_numpy() returns it.
  • NumPy functions such as np.log and np.where work directly on pandas columns.
  • np.where(condition, a, b) is a fast vectorised if-else for creating columns.
  • Missing values appear as NaN, and functions such as np.nanmean ignore them.
11

Common NumPy mistakes

  • Using Python loops where a vectorised operation would be shorter and faster.
  • Confusing a view and a copy: slicing returns a view, so changing it changes the original.
  • Integer division surprises and mixed dtypes.
  • Ignoring NaN: most functions return NaN if any element is NaN.
12

When to reach for NumPy directly

In day-to-day analysis you will usually work in pandas, but a few tasks are cleaner in plain NumPy. Simulations with random numbers, matrix calculations, fast element-wise functions and anything involving arrays of more than two dimensions are examples.

It is also useful for checking a calculation independently: compute the same total with NumPy and with pandas and confirm they agree. Treat NumPy as the engine under the hood that you can open when needed.

13

NumPy functions worth memorising

FunctionWhat it does
np.where(cond, a, b)Choose a or b element by element
np.cumsum(x)Running total
np.diff(x)Difference between consecutive elements
np.unique(x, return_counts=True)Distinct values and how often each appears
np.corrcoef(x, y)Correlation matrix of two variables
np.round(x, 2)Round to a number of decimals

Learn with a trainer

Want to use NumPy and pandas the way analysts do at work? Explore Uncodemy's Data Analytics course and learn from industry trainers.

View Course
About these PDFs: These PDFs are study material for learning and revision. They are not a certificate, a degree or a promise of a job, and technology changes, so check official documentation for the latest details. Spot an error? Write to info@uncodemy.com and the trainer team will review it.
FAQ

Frequently Asked Questions

What is NumPy used for?
NumPy provides fast arrays and vectorised numerical operations, and it underlies pandas, SciPy and many other data libraries.
What is vectorisation?
Applying an operation to a whole array at once instead of looping element by element, which is faster and shorter.
What is broadcasting in NumPy?
Broadcasting lets arrays of different shapes be combined by stretching the smaller one along missing dimensions when shapes are compatible.
Is NumPy needed if I use pandas?
You can start with pandas alone, but NumPy knowledge helps you understand pandas behaviour and write faster numeric code.
Why does NumPy standard deviation differ from my spreadsheet?
NumPy uses the population formula by default. Set ddof=1 to get the sample standard deviation used by most spreadsheets.
Are these PDFs free to download?
Yes, the NumPy for data analysis guide PDF is free. A short form asks for your details before the download starts.