how to address a column in a 2d array python

Do you want to know the details about “how to address a column in a 2d array python”. If yes, you’re in the correct tutorial.

how to address a column in a 2d array python

>>> import numpy as np
>>> A = np.array([[1,2,3,4],[5,6,7,8]])

>>> A
array([[1, 2, 3, 4],
    [5, 6, 7, 8]])

>>> A[:,2] # returns the third columm
array([3, 7])

Final Thoughts

I hope this tutorial helps you to know about “how to address a column in a 2d array python”. If you have any questions regarding this post please let us know via the comment section. Share this article with your friends and family via social networks.

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coder Diksha. Here, I post about programming to help developers.

Share on:

Leave a Comment