CellsView

class modelx.core.space.CellsView(data, keys=None)[source]

Bases: modelx.core.base.SelectedView

A mapping of cells names to cells objects.

CellsView objects are returned by StaticSpace.cells property. When StaticSpace.cells is called without subscription([] operator), the returned CellsView contains all the cells in the space.

CellsView supports a normal subscription([]) operation with one argument to retrieve a cells object from its name, but it also supports multiple arguments to indicate the names of cells to select, and returns another CellsView containing only the selected cells.

For example, if space contains 3 cells foo, bar and baz:

>> space.cells
{foo,
 bar,
 baz}

>> space.cells['bar', 'baz']
{bar,
 baz}

Methods

__init__(data[, keys]) Initialize self.
get(k[,d])
items()
keys()
to_frame(*args) Convert the cells in the view into a DataFrame object.
values()
to_frame(*args)[source]

Convert the cells in the view into a DataFrame object.

If args is not given, this method returns a DataFrame that has an Index or a MultiIndex depending of the number of cells parameters and columns each of which corresponds to each cells included in the view.

args can be given to calculate cells values and limit the DataFrame indexes to the given arguments.

The cells in this view may have different number of parameters, but parameters shared among multiple cells must appear in the same position in all the parameter lists. For example, Having foo(), bar(x) and baz(x, y=1) is okay because the shared parameter x is always the first parameter, but this method does not work if the view has quz(x, z=2, y=1) cells in addition to the first three cells, because y appears in different positions.

Parameters:args (optional) – multiple arguments, or an iterator of arguments to the cells.
_baseattrs

A dict of members expressed in literals

get(k[, d]) → D[k] if k in D, else d. d defaults to None.
items() → a set-like object providing a view on D's items
keys() → a set-like object providing a view on D's keys
values() → an object providing a view on D's values