rename changed order in shapes dict.

This resulted in wrong column names when writing to ASCII file

two fixes (one would be enough):
1) keep order (build new directory)
2) write in order of labels in pandas dataframe, not in order in shapes
dict
This commit is contained in:
Martin Diehl 2019-12-10 20:04:03 +01:00
parent db91803b80
commit 4c1281b4fc
1 changed files with 3 additions and 2 deletions

View File

@ -203,7 +203,7 @@ class Table():
'' if info is None else ': {}'.format(info),
))
self.shapes[label_new] = self.shapes.pop(label_old)
self.shapes = {(label if label is not label_old else label_new):self.shapes[label] for label in self.shapes}
def sort_by(self,labels,ascending=True):
@ -234,8 +234,9 @@ class Table():
Filename or file for reading.
"""
seen = set()
labels = []
for l in self.shapes:
for l in [x for x in self.data.columns if not (x in seen or seen.add(x))]:
if(self.shapes[l] == (1,)):
labels.append('{}'.format(l))
elif(len(self.shapes[l]) == 1):