Sarravanabavan Durairaj
PRO
last year
Sarravanabavancountry asked

Why does the column start from 1 and not from 0?

Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi Sarravanabavan,

Good question — and it depends on the context.

In programming, indexing usually starts at 0. So in Python, for example:

matrix[0][0]  # first row, first column

But in mathematics, people usually count rows and columns starting from 1. So what programming calls "column 0", math might refer to as "column 1".

If you're learning from a math-based explanation or a textbook, it's normal to see columns numbered from 1. But if you're working with actual code, like Python or NumPy, indexing starts from 0.

So you're not doing anything wrong — it's just two different conventions.

If you have more questions, I am here to help.

Python
This question was asked as part of the Python Numpy for Data Science course.