DataSpec types#
BaseDataSpec#
- class BaseDataSpec(path)[source]#
Abstract base class for accessing data stored in files
Changed in version 0.18.0: The
is_hidden
parameter is removed.Changed in version 0.18.0: the class name is changed from
BaseDataClient
toBaseDataSpec
.See also
ExcelRange#
- class ExcelRange(path, range_, sheet=None, keyids=None)[source]#
Mapping class for accessing Excel ranges
An ExcelRange is a dict-like object that represents a range in an Excel file. The user can read values from the range or write values to it by the subscription operator
[]
. ExcelRange is a mapping class, thus it implements all the mapping methods and operations.ExcelRange objects can only be created by the
Model.new_excel_range
orUserSpace.new_excel_range
method.ExcelRange
is a subclass of theBaseDataSpec
abstract class. Thedataspecs
property list all theBaseDataSpec
instances held in the Model includingExcelRange
objects.New in version 0.9.0.
PandasData#
- class PandasData(path, data, filetype)[source]#
A subclass of
BaseDataSpec
that associates a pandas DataFrame or Series with a fileA
PandasData
holds a pandas DataFrame or Series object, and associates it with a file for writing and reading the object.A
PandasData
can be created only byUserSpace.new_pandas
orModel.new_pandas
.The DataFrame or Series held in
PandasData
objects are accessible throughvalue
property or a call()
method.- Parameters
path – Path to a file for saving data. If a relative path is given, it is relative to the model folder.
data – a pandas DataFrame or Series.
filetype (
str
) – String to specify the file format. “excel” or “csv”
See also
- path#
A path to the associated file as a pathlib.Path object.
Changed in version 0.18.0: The
expose_data
parameter is removed.
- property PandasData.value#
pandas DataFrame or Series held in the object
ModuleData#
- class ModuleData(path, module=None)[source]#
A subclass of
BaseDataSpec
that associates a user module with its source file in the modelA
ModuleData
is created either byUserSpace.new_module
orModel.new_module
when a user module is assigned to a Reference. TheModuleData
is assigned to the_mx_dataclient
attribute of the module.New in version 0.13.0.
- property ModuleData.value#
Module held in the object