alter data

allows to access multiple columns ('f') and individual components
('1_f')
This commit is contained in:
Martin Diehl 2019-11-27 10:56:29 +01:00
parent 96714089b1
commit 39734ef53c
1 changed files with 10 additions and 0 deletions

View File

@ -83,6 +83,16 @@ class Table():
else:
return self.data[label].to_numpy().reshape((-1,)+self.headings[label])
def set_array(self,label,array):
"""Set data."""
if re.match(r'[0-9]*?_',label):
idx,key = label.split('_',1)
iloc = self.data.columns.get_loc(key).tolist().index(True) + int(idx) -1
self.data.iloc[:,iloc] = array
else:
self.data[label] = array
def get_labels(self):
"""Return the labels of all columns."""
return [label for label in self.headings]