larch.Dataset.dc.from_idca#
- static Dataset.dc.from_idca(df: DataFrame, *, crack: bool = True, altnames: Mapping[int, str] | Sequence[str] | None = None, avail: str = '_avail_', fill_missing: dict | None = None) Dataset #
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. This argument has no effect if the data is already in idca format.
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.dc.from_idce
Construct a Dataset from a sparse idca-format DataFrame.