polishing

This commit is contained in:
Martin Diehl 2020-01-12 07:53:41 +01:00
parent 1315029196
commit 19e88df571
1 changed files with 4 additions and 5 deletions

View File

@ -3,7 +3,6 @@ import re
import pandas as pd
import numpy as np
from . import version
class Table():
"""Store spreadsheet-like data."""
@ -22,7 +21,7 @@ class Table():
Additional, human-readable information.
"""
self.comments = [c for c in comments]
self.comments = [] if comments is None else [c for c in comments]
self.data = pd.DataFrame(data=data)
self.shapes = shapes
self.__label_condensed()
@ -77,7 +76,7 @@ class Table():
if keyword == 'header':
header = int(header)
else:
raise Exception
raise TypeError
comments = [f.readline()[:-1] for i in range(1,header)]
labels = f.readline().split()
@ -138,7 +137,7 @@ class Table():
data = np.loadtxt(content)
for c in range(data.shape[1]-10):
shapes['user_defined{}'.format(c+1)] = (1,)
shapes['n/a_{}'.format(c+1)] = (1,)
return Table(data,shapes,comments)