Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
numpy diagonal
#1
hi, need help with numpy.diagonal.
Using
 grid.diagonal(0)
for a 9 by 9 matrix
I can see the diagonal [0,0} to [8,8}.
How do I see the diagonal [0,8] - [8,0]?
Also how do I display cell row and column ([0, 0]) rather than values?
Thanks for any help
Reply
#2
Use numpy.flipud first and then .diagonal; i.e. np.flipud(x).diagonal()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Numpy] How to store different data type in one numpy array? water 7 294 Mar-26-2024, 02:18 PM
Last Post: snippsat
  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
  "erlarge" a numpy-matrix to numpy-array PhysChem 2 2,932 Apr-09-2019, 04:54 PM
Last Post: PhysChem
  Diagonal grid products PythonLamer 1 2,482 Dec-05-2017, 11:32 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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