UserSpace.new_space_from_pandas

UserSpace.new_space_from_pandas(obj, space=None, cells=None, param=None, space_params=None, cells_params=None)

Create child spaces from Pandas DataFrame or Series.

Create a space named space and optionally and cells in it from Pandas DataFrame or Series passed in obj. If space is not given, the space is named SpaceN where N is automatically given by modelx. Parameter names are taken from obj indexes, unless param is given to override index names.

obj can have MultiIndex as its index. If the index(es) of obj has/have name(s), the parameter name(s) of the cells is/are set to the name(s), but can be overwritten by param parameter. If the index(es) of obj has/have no name(s), and param is not given, error is raised.

Parameters
  • obj – DataFrame or Series.

  • space – Space name.

  • param – Sequence of strings to set parameter name(s). A single string can also be passed to set a single parameter name when frame has a single level index (i.e. not MultiIndex).

  • space_params – Sequence of strings or integers to specify space parameters by name or index.

  • cells_params – Sequence of strings or integers to specify cells parameters by name or index.

See also

new_cells_from_pandas(): Create Cells from DataFrame or Series.