[skip ci] added "list(map..." required since Python3

This commit is contained in:
Philip Eisenlohr 2020-04-22 21:36:05 -04:00
parent 898cf42aca
commit f0e2437d75
1 changed files with 7 additions and 7 deletions

View File

@ -97,10 +97,10 @@ for name in filenames:
for col,dim in zip(columns,dims): for col,dim in zip(columns,dims):
if options.unique: if options.unique:
s = set(map(tuple,table.data[:,col:col+dim])) # generate set of (unique) values s = set(map(tuple,table.data[:,col:col+dim])) # generate set of (unique) values
uniques = np.array(map(np.array,s)) # translate set to np.array uniques = np.array(list(map(np.array,s))) # translate set to np.array
shuffler = dict(zip(s,np.random.permutation(len(s)))) # random permutation shuffler = dict(zip(s,np.random.permutation(len(s)))) # random permutation
table.data[:,col:col+dim] = uniques[np.array(map(lambda x: shuffler[tuple(x)], table.data[:,col:col+dim] = uniques[np.array(list(map(lambda x: shuffler[tuple(x)],
table.data[:,col:col+dim]))] # fill table with mapped uniques table.data[:,col:col+dim])))] # fill table with mapped uniques
else: else:
np.random.shuffle(table.data[:,col:col+dim]) # independently shuffle every row np.random.shuffle(table.data[:,col:col+dim]) # independently shuffle every row