bugfixes: invalid python code

This commit is contained in:
Martin Diehl 2020-01-20 13:06:32 +01:00
parent b23479bfc9
commit e3d35b41b4
1 changed files with 6 additions and 6 deletions

View File

@ -23,11 +23,11 @@ class Table():
""" """
self.comments = [] if comments is None else [c for c in comments] self.comments = [] if comments is None else [c for c in comments]
try: if hasattr(data,'columns'):
self.data = data self.data = data
self.data.columns = [''] * len(self.data.columns) self.data.columns = [''] * len(self.data.columns)
except: else:
self.data = pd.DataFrame(data=data) self.data = pd.DataFrame(data=data)
self.shapes = shapes self.shapes = shapes
self.__label_condensed() self.__label_condensed()
@ -81,15 +81,15 @@ class Table():
N_comment_lines,keyword = f.readline().split() N_comment_lines,keyword = f.readline().split()
if keyword != 'header': if keyword != 'header':
raise TypeError raise TypeError
else: else:
comments = [f.readline().strip() for i in range(1,int(N_comment_lines))] comments = [f.readline().strip() for i in range(1,int(N_comment_lines))]
labels = f.readline().split() labels = f.readline().split()
except TypeError: except TypeError:
f.seek(0) f.seek(0)
comments = [] comments = []
line = f.readline().strip() line = f.readline().strip()
while line.startswith('#'): while line.startswith('#'):
comments.append(line.lstrip('#').lstrip()) comments.append(line.lstrip('#').strip())
line = f.readline().strip() line = f.readline().strip()
labels = line.split() labels = line.split()