Python Forum
finding element of specific field in pandas adjacency matrix
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
finding element of specific field in pandas adjacency matrix

I have a pandas adjacency dataframe where I need to be able to identify any element on that dataframe by its physical numbered position, not index or column position, nor its coordinate.

the data frame is a 10,000 x 10,000 adjacency matrix:

(10103, 10103)
Instead of doing something like
adj.iloc[coord1], [coord2]]
(which works fine), i need to be able to find the value on the data frame by its physical number from 0 - 100,000,000 (0 being the very first field and 100,000,000 being the very last.

I have tried (what i believe is) a clunky way of doing which is to stack the dataframe, convert to list then find the appropriate value at the index i am interested in:

(or any other number which tells me what the value is at that position. this also works perfectly, but I would like to be able to keep the adjacency matrix intact. any help would be much appreciated!


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to multiply a matrix with herself, until the zero matrix results peanutbutterandjelly 3 1,169 May-03-2021, 06:30 AM
Last Post: Gribouillis
  Bug ? when dataclass field name == field type Cyril 0 508 Oct-22-2020, 03:26 AM
Last Post: Cyril
  Finding an element in a 1d list in a 2d array lionrocker221 0 743 Jun-27-2020, 04:50 PM
Last Post: lionrocker221
  Remove isolated vertices from dictionary and adjacency matrix Weird 1 724 Jan-18-2020, 04:33 PM
Last Post: Weird
  Delete specific lines contain specific words mannyi 2 2,176 Nov-04-2019, 04:50 PM
Last Post: mannyi
  Finding a specific line in a file Vqlk 3 1,301 Sep-07-2019, 08:20 PM
Last Post: Axel_Erfurt
  Unable to locate element no such element gahhon 6 2,023 Feb-18-2019, 02:09 PM
Last Post: gahhon
  Finding all maximum values in a matrix Lightning1800 3 2,196 May-14-2018, 03:55 PM
Last Post: Lightning1800
  How to extract specific numbers from a matrix? Alberto 0 1,987 Mar-06-2018, 02:52 PM
Last Post: Alberto
  Newbie question for sum the specific element in named tuple zydjohn 1 2,838 Dec-12-2017, 07:29 PM
Last Post: buran

Forum Jump:

User Panel Messages

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