allow init of empty table

This commit is contained in:
Philip Eisenlohr 2022-05-18 18:30:18 -04:00
parent 0962d2ebdf
commit b1b845cb5c
1 changed files with 3 additions and 3 deletions

View File

@ -12,8 +12,8 @@ class Table:
"""Manipulate multi-dimensional spreadsheet-like data.""" """Manipulate multi-dimensional spreadsheet-like data."""
def __init__(self, def __init__(self,
shapes: dict, shapes: dict = {},
data: np.ndarray, data: np.ndarray = None,
comments: Union[str, list] = None): comments: Union[str, list] = None):
""" """
New spreadsheet. New spreadsheet.
@ -405,7 +405,7 @@ class Table:
new = pd.DataFrame(data=data.reshape(-1,size), new = pd.DataFrame(data=data.reshape(-1,size),
columns=[label]*size, columns=[label]*size,
) )
new.index = dup.data.index new.index = new.index if dup.data.index.empty else dup.data.index
dup.data = pd.concat([dup.data,new],axis=1) dup.data = pd.concat([dup.data,new],axis=1)
return dup return dup