Python Forum
numpy.where array search for string in just one coordinate
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
numpy.where array search for string in just one coordinate
#1
I have the following array:
[[  258 16892 40056]
 [  259 25647 40056]
 [  260 25847 40056]
 [  261 47339 259]]
I want to search in it and find rows where just the first element == 259.
This call will find it twice in row 1 and row 3:
np.where(intArrayFromLine == 259 )
How do I compose the np.where (or other call) so that it only looks in the first column - ie so it would find just row 1 ?
thans
Reply
#2
np.where(intArrayFromLine[:,0] == 259)
the "0" is for the 1rst column
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Numpy] How to store different data type in one numpy array? water 7 288 Mar-26-2024, 02:18 PM
Last Post: snippsat
  reshaping 2D numpy array paul18fr 3 969 Jan-03-2023, 06:45 PM
Last Post: paul18fr
  Numpy returns "TypeError: unsupported operand type(s) for *: 'numpy.ufunc' and 'int'" kalle 2 2,527 Jul-19-2022, 06:31 AM
Last Post: paul18fr
  Coordinate conversion erdemath 8 2,559 Oct-28-2021, 12:48 PM
Last Post: erdemath
  Numpy array BrianPA 13 4,837 Jan-23-2021, 09:36 AM
Last Post: Serafim
  How to search for specific string in Pandas dataframe Coding_Jam 1 2,415 Nov-02-2020, 09:35 AM
Last Post: PsyPy
  How to fill datetime64 field in numpy structured array? AlekseyPython 0 2,234 Oct-20-2020, 08:17 AM
Last Post: AlekseyPython
  Adding data in 3D array from 2D numpy array asmasattar 0 2,168 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,086 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