Python Forum
NumPy array; selecting the a single column
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
NumPy array; selecting the a single column
#1
I have a numpy array with data. How do I select the first column
my_array =numpy.array([[1,2,3], [1,2,3]])
I can get the first row (1,2,3) by:
first_row = my_array[0]
I simply want a code to give me the first column.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Numpy] How to store different data type in one numpy array? water 7 293 Mar-26-2024, 02:18 PM
Last Post: snippsat
  reshaping 2D numpy array paul18fr 3 970 Jan-03-2023, 06:45 PM
Last Post: paul18fr
  Numpy returns "TypeError: unsupported operand type(s) for *: 'numpy.ufunc' and 'int'" kalle 2 2,530 Jul-19-2022, 06:31 AM
Last Post: paul18fr
  Numpy array BrianPA 13 4,838 Jan-23-2021, 09:36 AM
Last Post: Serafim
  Nested array API call, how to split into its own column? new2datasci 0 1,619 Nov-27-2020, 06:46 AM
Last Post: new2datasci
  How to fill datetime64 field in numpy structured array? AlekseyPython 0 2,235 Oct-20-2020, 08:17 AM
Last Post: AlekseyPython
  Multi-Indexing in Single Column illmattic 2 1,544 Oct-16-2020, 06:36 PM
Last Post: illmattic
  Adding data in 3D array from 2D numpy array asmasattar 0 2,169 Jul-23-2020, 10:55 AM
Last Post: asmasattar
  converting dataframe to int numpy array glennford49 1 2,290 Apr-04-2020, 06:15 AM
Last Post: snippsat
  Replacing sub array in Numpy array ThemePark 5 4,090 Apr-01-2020, 01:16 PM
Last Post: ThemePark

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020