Data Analytics
Data Analysis with Excel
Turn raw data into clear answers with formulas, pivot tables and charts
Load, clean, summarise and chart real data with Python
4 sections · 13 lessons · 8h 55m
Data analysis with Python is usually done in a notebook rather than a plain .py file. A notebook is a document made of cells. A cell can hold code or notes. You run one cell at a time and the result appears directly below it: a number, a table or a chart. You can try an idea, look at the output, fix it and move on without re-running the whole program.
The two most common notebook tools are Jupyter Notebook (or the newer JupyterLab), which runs on your own computer, and Google Colab, which runs in the browser on Google's servers.
| Google Colab | Jupyter on your computer | |
|---|---|---|
| Installation | None, just a browser | Python plus Jupyter |
| Internet | Needed all the time | Not needed after setup |
| Libraries | pandas, NumPy, matplotlib already included | You install them once |
| Files | Upload, or connect Google Drive | Normal folders on your disk |
| Best for | Low-spec laptops, cyber cafés, quick start | Daily work, private data |
colab.research.google.com.Untitled0.ipynb opens and is saved in your Google Drive.pandas-practice.ipynb.To use your own data file, click the folder icon on the left and then the upload button. Uploaded files are deleted when the session ends, so keep the originals on your computer or in Drive.
If Python 3 is already installed, open Command Prompt (Windows) or Terminal (macOS/Linux) and run:
pip install notebook pandas numpy matplotlib openpyxl
jupyter notebook
A browser tab opens showing your folders. Choose New → Python 3 to create a notebook. Keep the command window open while you work, because closing it stops Jupyter. On some systems the command is pip3 or python -m pip instead of pip.
Many people also use Visual Studio Code with the Python and Jupyter extensions, which can open .ipynb files directly.
Type this in a code cell and run it:
import pandas as pd
import numpy as np
print("pandas version:", pd.__version__)
import pandas as pd loads the library under the short name pd. Almost every pandas tutorial and job uses this naming, so stick to it. The version number tells you which pandas you have. This course works with current 2.x and 3.x releases.
Now try a quick calculation:
prices = [120, 95, 130]
sum(prices)
Output:
345
Notice that you did not need print(). A notebook automatically displays the value of the last line in a cell.
Change a cell's type to Markdown (in Colab click + Text; in Jupyter press M while the cell is selected) and write headings and notes such as "Step 1: load the data". Good analysts explain each step, so that a manager, or you three months later, can follow the reasoning.
.ipynb).pd and NumPy as np.pandas-practice.sum() and max().NumPy (Numerical Python) is the library that makes calculations on many numbers fast. Pandas is built on top of it: every numeric column in a pandas table is stored as a NumPy array. You will not write much pure NumPy as an analyst, but understanding arrays explains how pandas behaves.
With a normal Python list, adding 18% GST to every price needs a loop. With a NumPy array, the operation applies to every element at once. This is called vectorisation.
import numpy as np
prices = np.array([120, 95, 130, 80, 150])
print(prices * 2)
print(np.round(prices * 1.18, 2))
Output:
[240 190 260 160 300]
[141.6 112.1 153.4 94.4 177. ]
Compare that with a list: [120, 95] * 2 gives [120, 95, 120, 95], because for lists * means "repeat", not "multiply each value".
Arrays have built-in methods for summaries:
print(prices.sum(), prices.mean(), prices.max(), prices.min())
print(prices.std().round(2))
Output:
575 115.0 150 80
24.9
std() is the standard deviation, which measures how spread out the values are.
A comparison on an array gives an array of True/False values called a boolean mask. Use the mask inside square brackets to keep only the matching values:
print(prices > 100)
print(prices[prices > 100])
Output:
[ True False True False True]
[120 130 150]
This same idea is how you filter rows in pandas later in the course, so it is worth practising now.
An array can have rows and columns, like a small table. Here are sales of three products (columns) over two days (rows):
sales = np.array([[10, 20, 30],
[40, 50, 60]])
print(sales.shape)
print(sales.sum(axis=0)) # total per column (product)
print(sales.sum(axis=1)) # total per row (day)
Output:
(2, 3)
[50 70 90]
[ 60 150]
shape gives (rows, columns). The axis argument confuses many learners: axis=0 works down the rows and gives one answer per column, while axis=1 works across the columns and gives one answer per row. Pandas uses the same convention.
| Code | Result |
|---|---|
np.arange(0, 10, 2) | [0 2 4 6 8] (start, stop, step; stop not included) |
np.zeros(3) | [0. 0. 0.] |
np.ones(4) | [1. 1. 1. 1.] |
np.linspace(0, 1, 5) | five evenly spaced values from 0 to 1 |
NumPy represents a missing number as np.nan ("not a number"). Any arithmetic with nan gives nan, so normal functions can return nan for the whole array. NumPy has "nan-safe" versions:
marks = np.array([10, np.nan, 20])
print(marks.mean())
print(np.nanmean(marks))
Output:
nan
15.0
Pandas handles missing values more conveniently, as you will see in Section 3, but it uses the same NaN idea.
All elements of an array share one data type (dtype), such as int64 or float64. If you mix an integer and a decimal, everything becomes a float. If you mix numbers and text, everything becomes text and maths stops working. This is why a single stray word such as "NA" in a numeric column of a CSV file can turn the whole column into text in pandas.
max(list) habits on huge data instead of array methods, which is slower.axis=0 and axis=1. Check shape and test on a tiny example.prices[1:3] to include position 3. Slices stop before the end index, just like lists.prices[prices > 100] filter data.axis=0 gives one result per column; axis=1 gives one per row.np.nan marks missing numbers; use nan-safe functions or pandas.[42, 38, 45, 50, 41, 39, 55]..sum() on the boolean mask.axis.If you already know a little Python, pandas is the next step. It is the most widely used Python library for working with tables of data. Tasks that take many clicks in a spreadsheet, such as cleaning 50,000 rows, combining two files or building a monthly summary, take a few lines of pandas code. The same code runs again next month on new data.
You will work in a notebook (Jupyter on your computer, or Google Colab in the browser, which is free and needs no installation). Every lesson uses small, realistic Indian datasets, such as shop sales, student marks and city orders, that you type or create yourself. Each lesson shows the code, the output it produces and the common mistakes, and ends with a practice task.
You will finish with a complete sales analysis notebook. It loads a messy file, cleans it, calculates revenue by month, city and product, draws charts and exports a summary. You can show this kind of project to employers.
Students, job seekers aiming for data or MIS roles, Excel users who want to automate their work, and anyone who has finished a beginner Python course. Take our Python Programming for Beginners course first if you are new to Python.
Pass the final online exam (20 minutes, 15 questions, pass mark 40%) to receive your certificate instantly. Each certificate has a unique number and QR code for instant verification.
This is an independent, institute-issued skill-training certificate — not a government-recognised degree or diploma.
Muninder Singh
Leave your details and our team will get back to you, usually within one working day.
Data Analytics
Turn raw data into clear answers with formulas, pivot tables and charts
Data Analytics
Query databases to answer business questions
Data Analytics
Turn Excel and CSV data into interactive dashboards
Free
Includes certificate