Unable to use Python utilities with a numpy array that was converted from an .xslx file
by Squirrel1 from LinuxQuestions.org on (#6E36G)
I am trying to sort a list in a numpy array using sort() that was loaded from an Excel spreadsheet document. I have tried six different methods with no success. When I get a table ported across to numpy, it won't sort because of the syntax. Still, I can sort arrays that were added to Python manually such as:
<code>
lst = [
('john', 'C', 15),
('jane', 'A', 12),
('dave', 'D', 10),
]
lst.sort()
</code>
because the result contains comma delimiters. I have failed to find a way to convert from an .xlsx spreadsheet to a numpy array that contains comma delimiters.
My most recent attempt (which does not work) is:
<code>
arr = np.zeros((37,3))
for i in range(2,39):
for j in range(1,4):
arr[i-2,j-1]= ws.cell(row = i, column = j).value
</code>
Has anybody solved the problem that I am having? Thanks!
<code>
lst = [
('john', 'C', 15),
('jane', 'A', 12),
('dave', 'D', 10),
]
lst.sort()
</code>
because the result contains comma delimiters. I have failed to find a way to convert from an .xlsx spreadsheet to a numpy array that contains comma delimiters.
My most recent attempt (which does not work) is:
<code>
arr = np.zeros((37,3))
for i in range(2,39):
for j in range(1,4):
arr[i-2,j-1]= ws.cell(row = i, column = j).value
</code>
Has anybody solved the problem that I am having? Thanks!