UserSpace.new_cells_from_pandas#
- UserSpace.new_cells_from_pandas(obj, cells=None, param=None)[source]#
Create new cells from Pandas Series or DataFrame object.
Return new cells created from Pandas Series or DataFrame object passed as
obj
.obj
can either be a Series or a DataFrame. Ifobj
is a Series, a single cells is created. The cells’ name is taken from the Series’ name, but can be overwritten if a valid name is passed ascells
.If
obj
is a DataFrame, a cells is created for each column. The cells’ names can be overwritten by a sequence of valid names passed ascells
Keys and values of the cells data are copied from
obj
.obj
can have MultiIndex. If the index(es) ofobj
has/have name(s), the parameter name(s) of the cells is/are set to the name(s), but can be overwritten byparam
parameter. If the index(es) ofobj
has/have no name(s), andparam
is not given, error is raised. Error is raised whenobj
has duplicated indexes.- Parameters
obj – Pandas Series or DataFrame object
cells (str, optional) – cells name. If
obj
has a valid name and thiscells
is not given, the name is used. Ifobj
does not have a name and thiscells
is not given, the cells is named automatically.param – sequence of strings to set parameter name(s). A single string can also be passed to set a single parameter name when
obj
has a single level index (i.e. not MultiIndex).
- Returns
New cells if
obj
is a Series, CellsView ifobj
is DataFrame.
See also
new_space_from_pandas()
: Create Spaces and Cells from DataFrame or Series.