I currently am reading in colors from an SQLite database in the following way:
import numpy as np, apsw
connection = apsw.Connection(db_name)
cursor = connection.cursor()
desc = {'names':('name','R','G','B'),'formats':('a3','float','float','float')}
colorlist = np.array(cursor.execute("SELECT name, R, G, B FROM Colors").fetchall(),desc)
But I was hoping to read in this data in a NumPy array with only two columns, where the second column is a tuple containing (R,G,B), i.e. something like:
desc = {'names':('name','Color'),'formats':('a3','float_tuple')}
colorlist = np.array(cursor.execute("SELECT name, R, G, B FROM Colors").fetchall(),desc)
I want to do this to simplify some of my later statements where I extract the color from the array as a tuple and to eliminate my need to create a dictionary to do this for me:
colorlist[colorlist['name']=='BOS']['Color'][0]