Model

class Model(_impl)[source]

Top-level container in modelx object hierarchy.

Model instances are the top-level objects and directly contain UserSpace objects, which in turn contain other spaces or Cells objects.

A model can be created by new_model() API function.

Model properties

name

Name of the object.

fullname

Dotted name of the object.

doc

Description string

model

The model this object belongs to.

parent

The parent of this object.

allow_none

Whether a cells can have None as its value.

properties

spaces

A mapping of the names of child spaces to the Space objects

refs

Return a mapping of global references.

dataclients

List of BaseDataClient objects

tracegraph

A directed graph of cells.

Model operations

close()

Close the model.

rename(name[, rename_old])

Rename the model itself

set_property(name, value)

Set property name

Saving operations

write(model_path[, backup, log_input])

Write model to files.

zip(model_path[, backup, log_input, …])

Archive model to a zip file.

backup(filepath[, datapath])

Back up the model to a file.

save(filepath[, datapath])

Back up the model to a file.

Child Space operations

cur_space([name])

Set the current space to Space name and return it.

import_module([module, recursive])

Create a child space from an module.

new_space([name, bases, formula, refs])

Create a child space.

new_space_from_csv(filepath[, space, cells, …])

Create spaces from from a comma-separated values (csv) file.

new_space_from_excel(book, range_[, sheet, …])

Create a child space from an Excel range.

new_space_from_module(module[, recursive])

Create a child space from an module.

new_space_from_pandas(obj[, space, cells, …])

Create child spaces from Pandas DataFrame or Series.

new_excel_range(name, path, range_[, sheet, …])

Creates a Reference to an Excel range