finished app domain conversion #120

This commit is contained in:
Liam Brydon
2025-11-05 12:41:33 +13:00
parent 13af49488e
commit f1f7ce344c
2 changed files with 63 additions and 81 deletions

View File

@ -52,7 +52,7 @@ class Dataset(ABC):
self.add_rows([row])
def block_indices(self, prefix) -> List[int]:
"""Find the start and end indexes in column labels that has the prefix"""
"""Find the indexes in column labels that has the prefix"""
indices: List[int] = []
for i, feature in enumerate(self.columns):
if feature.startswith(prefix):
@ -128,6 +128,29 @@ class Dataset(ABC):
def iter_rows(self, named=False):
return self.df.iter_rows(named=named)
def filter(self, *predicates, **constraints):
return self.__class__(data=self.df.filter(*predicates, **constraints))
def select(self, *exprs, **named_exprs):
return self.__class__(data=self.df.select(*exprs, **named_exprs))
def with_columns(self, *exprs, **name_exprs):
return self.__class__(data=self.df.with_columns(*exprs, **name_exprs))
def sort(self, by, *more_by, descending=False, nulls_last=False, multithreaded=True, maintain_order=False):
return self.__class__(data=self.df.sort(by, *more_by, descending=descending, nulls_last=nulls_last,
multithreaded=multithreaded, maintain_order=maintain_order))
def item(self, row=None, column=None):
return self.df.item(row, column)
def fill_nan(self, value):
return self.__class__(data=self.df.fill_nan(value))
@property
def height(self):
return self.df.height
class RuleBasedDataset(Dataset):
def __init__(self, num_labels=None, columns=None, data=None):