I would just use a lookup dict:
names = [ "uc_berkeley", "stanford", "uiuc", "google", "intel",
"texas_instruments", "bool"]
lookup = dict( zip( range(len(names)), names ) )
Now, given you have n entries:
S = numpy.zeros( (n, len(names)) ,dtype=numpy.int32)
for k in ["uc_berkeley", "google",
Hi numpy users,
*Is there a convenient way in numpy to go from "string" features like:*
"uc_berkeley", "google", 1
"stanford", "intel", 1
.
.
.
"uiuc", "texas_instruments", 0
*to a numpy matrix like:*
"uc_berkeley", "stanford", ..., "uiuc", "google", "intel",
"texas_instruments", "bool"