larch.Dataset.construct

larch.Dataset.construct

classmethod Dataset.construct(source, caseid=None, alts=None)[source]

A generic constructor for creating Datasets from various similar objects.

Parameters
  • source (pandas.DataFrame, pyarrow.Table, xarray.Dataset, or Sequence[str]) – The source from which to create a Dataset. DataFrames and Tables are converted to Datasets that have one dimension (the rows) and seperate variables for each of the columns. A list of strings creates a dataset with those named empty variables.

  • caseid (str, optional) – The name of a dimension referencing cases.

  • alts (Mapping or str or array-like, optional) – If given as a mapping, links alternative codes to names. A string names a dimension that defines the alternatives. An array or list of integers gives codes for the alternatives, which are otherwise unnamed.

Returns

Dataset