UserSpace#

class UserSpace(_impl)[source]#

Container of cells, other spaces, and cells namespace.

UserSpace objects can contain cells and other spaces. Spaces have mappings of names to objects that serve as global namespaces of the formulas of the cells in the spaces.

Basic properties#

name

Name of the object.

fullname

Dotted name of the object.

doc

Documentation string

allow_none

Whether a cells can have None as its value.

model

The model this object belongs to.

parent

The parent of this object.

properties

refs

A map associating names to objects accessible by the names.

has_params()

Check if the parameter function is set.

set_property(name, value)

Set property name

Space operations#

copy(parent[, name, defined_only])

Make a copy of itself

rename(name)

Rename the space

Inheritance operations#

bases

List of base classes.

add_bases(*bases)

Add base spaces.

remove_bases(*bases)

Remove base spaces.

Child Space operations#

spaces

A mapping associating names to named spaces.

named_spaces

A mapping associating names to named spaces.

static_spaces

A mapping associating names to named spaces.

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.

reload()

Reload the source module and update the formulas.

clear_all()

Clears Cells and ItemSpace.

Child Cells operations#

cells

A mapping of cells names to the cells objects in the space.

new_cells([name, formula])

Create a cells in the space.

new_cells_from_csv(filepath[, cells, param])

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

new_cells_from_excel(book, range_[, sheet, ...])

Create multiple cells from an Excel range.

new_cells_from_module(module)

Create a cells from a module.

new_cells_from_pandas(obj[, cells, param])

Create new cells from Pandas Series or DataFrame object.

import_funcs(module)

Create a cells from a module.

clear_cells([clear_input, recursive])

Clears child Cells.

sort_cells()

Sort child cells alphabetically

Reference operations#

set_ref(name, value, refmode)

Set a Reference

absref(**kwargs)

Set absolute References

relref(**kwargs)

Set relative References

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

Creates a Reference to an Excel range

new_pandas(name, path, data[, file_type, ...])

Create a Reference bound to a pandas DataFrame or Series associating a new PandasData object.

new_module(name, path, module)

Assigns a user module to a Reference associating a new ModuleData object

ItemSpace operations#

itemspaces

A mapping of arguments to ItemSpace objects.

parameters

A tuple of parameter strings.

formula

Property to get, set, delete formula.

set_formula(formula)

Set if the parameter function.

del_formula()

Delete formula

clear_items()

Deletes all the child ItemSpace objects.

clear_at(*args, **kwargs)

Delete a child ItemSpace object

node(*args, **kwargs)

Return a Node object for the given arguments.

preds(*args, **kwargs)

Return a list of predecessors of a cell.

succs(*args, **kwargs)

Return a list of successors of a cell.

precedents(*args, **kwargs)

Return a list of the precedents.

Exporting to Pandas objects#

frame

Alias of to_frame().

to_frame(*args)

Convert the space itself into a Pandas DataFrame object.