alter data
allows to access multiple columns ('f') and individual components ('1_f')
This commit is contained in:
parent
96714089b1
commit
39734ef53c
|
@ -83,6 +83,16 @@ class Table():
|
||||||
else:
|
else:
|
||||||
return self.data[label].to_numpy().reshape((-1,)+self.headings[label])
|
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):
|
def get_labels(self):
|
||||||
"""Return the labels of all columns."""
|
"""Return the labels of all columns."""
|
||||||
return [label for label in self.headings]
|
return [label for label in self.headings]
|
||||||
|
|
Loading…
Reference in New Issue