allow init of empty table
This commit is contained in:
parent
0962d2ebdf
commit
b1b845cb5c
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue