Article 6FADB Copying from a sorted 2d array to another 2d array fails

Copying from a sorted 2d array to another 2d array fails

by
Squirrel1
from LinuxQuestions.org on (#6FADB)
I am trying to copy from a cell in a 2d array that has been sorted to another cell in another 2d array. In my code, it copies the value into every cell in the column. However, I was unable to reproduce this error into a smaller version to post online. Instead, this version attempts such a copy and it copies nothing. This is just as bad. If we can solve this one, we can probably solve my problem too. Thanks in advance for your help!
Code:import numpy as np

arr = []
arrSorted = []
destination = []

mrow = 60
columnIndex = 2
columnName = 'Column3'

arr = np.zeros(mrow, dtype={'names':('Column1', 'Column2', 'Column3', 'Column4', 'Column5', 'Column6'),
'formats':('S30', 'S30', 'S30', 'i4', 'i4', 'i4')})
destination = np.zeros(mrow, dtype={'names':('Column1', 'Column2', 'Column3', 'Column4', 'Column5', 'Column6'),
'formats':('S30', 'S30', 'S30', 'i4', 'i4', 'i4')})

for row in range(0,59): #Generate some data
arr[row][columnIndex - 2] = chr(127 - row)
arr[row][columnIndex] = chr(127 - row)

arr[0][0] = "Hello"
arr[0][1] = "There"
arr[0][2] = "Joe"

arrSorted = np.sort(arr,order=columnName) #Sort the contents of the given column
print("arr = " + str(arr))

row= 0
print("arrSorted = " + str(arrSorted))
print("row, columnIndex = " + str(row) + " " + str(columnIndex))
print("destination = " + str(destination))
destination[row+1][columnIndex] = arrSorted[row][0]
print("destination after sort and extraction = " + str(destination))
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments