Sql pareto for column values per row help request

### Sample Dataset to simulate query result
import random
headers = ['col1', 'col2', 'col3', 'col4', 'col5', 'col6', 'col7', 'col8', 'col9', 'col10', 't_stamp', 'color', 'area']
data = []
t_stamp = system.date.now()
for i in range(10):
	newRow = [random.randrange(100) for j in range(10)]
	t_stamp = system.date.addMinutes(t_stamp, 1)
	newRow.extend([t_stamp, 'blue', 'zoneX'])
	data.append(newRow)
dataIn = system.dataset.toPyDataSet(system.dataset.toDataSet(headers, data))
#util.printDataSet(dataIn)
print '---'
### Sorting

# List of exluded columns
excluded_cols = ['t_stamp', 'color', 'area']

# Get columns to use in sorting
filteredHeaders = [colName for colName in dataIn.getColumnNames() if colName not in excluded_cols]

for row in dataIn:
	data = [row[colName] for colName in filteredHeaders]
	
	#Sorting a zip sorts all lists by the first one.
	pareto = [[x, y] for y, x in reversed(sorted(zip(data, filteredHeaders)))][:5]

	print row['t_stamp'], pareto
row | col1 | col2 | col3 | col4 | col5 | col6 | col7 | col8 | col9 | col10 | t_stamp                      | color | area 
-------------------------------------------------------------------------------------------------------------------------
0   | 99   | 40   | 49   | 0    | 70   | 32   | 76   | 69   | 70   | 33    | Mon May 02 12:39:36 EDT 2022 | blue  | zoneX
1   | 75   | 81   | 77   | 51   | 49   | 93   | 62   | 15   | 59   | 53    | Mon May 02 12:40:36 EDT 2022 | blue  | zoneX
2   | 45   | 7    | 39   | 63   | 74   | 31   | 29   | 8    | 82   | 44    | Mon May 02 12:41:36 EDT 2022 | blue  | zoneX
3   | 31   | 39   | 57   | 72   | 79   | 16   | 17   | 57   | 48   | 9     | Mon May 02 12:42:36 EDT 2022 | blue  | zoneX
4   | 1    | 24   | 68   | 57   | 66   | 92   | 54   | 72   | 46   | 67    | Mon May 02 12:43:36 EDT 2022 | blue  | zoneX
5   | 53   | 64   | 5    | 60   | 55   | 93   | 64   | 96   | 66   | 63    | Mon May 02 12:44:36 EDT 2022 | blue  | zoneX
6   | 41   | 24   | 23   | 82   | 50   | 89   | 77   | 74   | 99   | 27    | Mon May 02 12:45:36 EDT 2022 | blue  | zoneX
7   | 4    | 40   | 24   | 56   | 3    | 17   | 85   | 74   | 68   | 53    | Mon May 02 12:46:36 EDT 2022 | blue  | zoneX
8   | 33   | 16   | 64   | 55   | 76   | 64   | 21   | 44   | 13   | 14    | Mon May 02 12:47:36 EDT 2022 | blue  | zoneX
9   | 79   | 31   | 46   | 53   | 1    | 8    | 35   | 63   | 69   | 14    | Mon May 02 12:48:36 EDT 2022 | blue  | zoneX
---
Mon May 02 12:39:36 EDT 2022 [[u'col1', 99], [u'col7', 76], [u'col9', 70], [u'col5', 70], [u'col8', 69]]
Mon May 02 12:40:36 EDT 2022 [[u'col6', 93], [u'col2', 81], [u'col3', 77], [u'col1', 75], [u'col7', 62]]
Mon May 02 12:41:36 EDT 2022 [[u'col9', 82], [u'col5', 74], [u'col4', 63], [u'col1', 45], [u'col10', 44]]
Mon May 02 12:42:36 EDT 2022 [[u'col5', 79], [u'col4', 72], [u'col8', 57], [u'col3', 57], [u'col9', 48]]
Mon May 02 12:43:36 EDT 2022 [[u'col6', 92], [u'col8', 72], [u'col3', 68], [u'col10', 67], [u'col5', 66]]
Mon May 02 12:44:36 EDT 2022 [[u'col8', 96], [u'col6', 93], [u'col9', 66], [u'col7', 64], [u'col2', 64]]
Mon May 02 12:45:36 EDT 2022 [[u'col9', 99], [u'col6', 89], [u'col4', 82], [u'col7', 77], [u'col8', 74]]
Mon May 02 12:46:36 EDT 2022 [[u'col7', 85], [u'col8', 74], [u'col9', 68], [u'col4', 56], [u'col10', 53]]
Mon May 02 12:47:36 EDT 2022 [[u'col5', 76], [u'col6', 64], [u'col3', 64], [u'col4', 55], [u'col8', 44]]
Mon May 02 12:48:36 EDT 2022 [[u'col1', 79], [u'col9', 69], [u'col8', 63], [u'col4', 53], [u'col3', 46]]
3 Likes