DataSet

The DataSet class serves as the parent class for the Value, Table, and Breakdown classes. It contains simple property definitions for the starting cell, worksheet, data, and header. It also defines the behavior of DataSets as mediated objects when assigned a mediator like a Results instance.

class chromaquant.data.dataset.DataSet(data: Any = nan, start_cell: str = '', sheet: str = '', type: str = 'DataSet', header: str = '', results: Results = None)

Class used to store data alongside reporting information.

Parameters

dataAny, optional

Data to be stored.

start_cellstr, optional

Reference to cell in Excel where data will be reported. If data contains more than one item, refers to the top-left of report range. Must be a valid Excel cell (e.g., ‘A1’, ‘$B$2’).

sheetstr, optional

Name of Excel worksheet (sheet within workbook) where data will be reported.

type: str, optional

Type of DataSet, used by child classes to identify their type.

header: str, optional

Header to add above a dataset, equivalent to a title.

results: Results, optional

Results object that mediates this DataSet.

Raises

ValueError

If sheet is set to a blank string.

ValueError

If start_cell is set to an invalid Excel cell.

Notes

This class is primarily internal, and its child classes (e.g., Table) are the primary API for users to interact with.

property data: Any

Get, set, or delete data stored in the DataSet. Common types include str, bool, int, float, list, dict, or pandas DataFrame.

static get_cell_indices(cell: str) tuple[int, int]

Static method that returns the absolute indices of a cell.

Parameters

cellstr

Cell reference (e.g., ‘A1’, ‘$B$2’).

Returns

column_index: int

Absolute index of the reference column (e.g., 2 for ‘C1’).

row_index: int

Absolute index of the reference row (e.g., 0 for ‘C1’).

property header: str

Get, set, or delete the header to add above a dataset.

property mediator: str

Get or set the mediator object that controls the interactions between this DataSet and colleague objects.

property reference: dict[str, Any]

Get the current reference object for the DataSet. Unable to set or delete this value as it is managed internally.

property sheet: str

Get, set, or delete the name of the Excel worksheet to report to.

property start_cell: str

Get, set, or delete the Excel reference where data will be reported.