changed readArray default behavior to reading always scalars when columns are referenced by number

This commit is contained in:
Chen Zhang 2015-07-21 20:44:40 +00:00
parent b15f68905f
commit 08f4495721
1 changed files with 17 additions and 15 deletions

View File

@ -341,8 +341,10 @@ class ASCIItable():
labels_missing = np.array(labels)[missing] # labels of missing data
columns = []
for c in indices[present]: # for all valid labels ...
columns += range(c,c+self.label_dimension(c)) # ... transparently add all components
for i,c in enumerate(indices[present]): # for all valid labels ...
columns += range(c,c + \
(self.label_dimension(c) if str(c) != str(labels[present[i]]) \
else 1)) # ... transparently add all components unless column referenced by number
use = np.array(columns)
self.labels = list(np.array(self.labels)[use]) if use != [] else [] # ... for missing and present columns