Sachin Sharma
Sachin Sharma

Reputation: 89

What does zero-indexed mean in context of axis in numpy arrays?

I was studying concatenation of numpy arrays, where I encountered this code snippet:

# concatenate along the second axis (zero-indexed)
np.concatenate([grid, grid], axis=1)

What does the term zero-indexed mean in this context?

Maybe this screenshot may help you understand my problem:

enter image description here

Upvotes: 0

Views: 4358

Answers (1)

Vivs
Vivs

Reputation: 475

Python uses zero-based indexing. That means, the first element(value 'red') has an index 0, the second(value 'green') has index 1, and so on. Since you are concatenating its relevant as the array starts with 0 index

Upvotes: 1

Related Questions