larch.Dataset.from_idca

larch.Dataset.from_idca

classmethod Dataset.from_idca(df, crack=True, altnames=None, avail='_avail_', fill_missing=None)[source]

Construct a Dataset from an idca-format DataFrame.

This method loads the data as dense arrays.

Parameters
  • df (DataFrame) – The input data should be an idca-format or idce-format DataFrame, with the caseid’s and altid’s in a two-level pandas MultiIndex.

  • crack (bool, default True) – If True, the dissolve_zero_variance method is applied before repairing dtypes, to ensure that missing value are handled properly.

  • altnames (Mapping, optional) – If given as a mapping, links alternative codes to names. An array or list of strings gives names for the alternatives, sorted in the same order as the codes.

  • avail (str, default '_avail_') – When the imported data is in idce format (i.e. sparse) then an availability indicator is computed and given this name.

  • fill_missing (scalar or Mapping, optional) – Fill values to use for missing values when imported data is in idce format (i.e. sparse). Give a single value to use globally, or a mapping of {variable: value} or {dtype: value}.

Returns

Dataset

See also

Dataset.from_idce

Construct a Dataset from a sparse idca-format DataFrame.