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:
parent
db91803b80
commit
4c1281b4fc
|
@ -203,7 +203,7 @@ class Table():
|
||||||
'' if info is None else ': {}'.format(info),
|
'' 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):
|
def sort_by(self,labels,ascending=True):
|
||||||
|
@ -234,8 +234,9 @@ class Table():
|
||||||
Filename or file for reading.
|
Filename or file for reading.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
seen = set()
|
||||||
labels = []
|
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,)):
|
if(self.shapes[l] == (1,)):
|
||||||
labels.append('{}'.format(l))
|
labels.append('{}'.format(l))
|
||||||
elif(len(self.shapes[l]) == 1):
|
elif(len(self.shapes[l]) == 1):
|
||||||
|
|
Loading…
Reference in New Issue