Spaces:
Sleeping
Sleeping
File size: 792 Bytes
a2158c2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
from typing import Literal, Optional
class Table:
def __init__(
self,
columns=None,
data=None,
rows=None,
dataframe=None,
dtype=None,
optional=True,
allow_mixed_types=False,
log_mode: Optional[Literal['IMMUTABLE', 'MUTABLE', 'INCREMENTAL']] = 'IMMUTABLE'
):
# TODO: implement support for dtype, optional, allow_mixed_types, and log_mode.
# for now (like `rows`) they are included for API compat but don't do anything.
if dataframe is None:
self.columns = columns
self.data = data
else:
self.columns = list(dataframe.columns)
self.data = dataframe.to_dict(orient="records")
def to_dict(self):
return self.data |