larch.Dataset.from_idce
larch.Dataset.from_idce¶
- classmethod Dataset.from_idce(df, crack=True, altnames=None, dim_name=None, alt_index='alt_idx', case_index=None, case_pointer=None)[source]¶
Construct a Dataset from a sparse idca-format DataFrame.
- 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 False) – 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.
dim_name (str, optional) – Name to apply to the sparse index dimension.
alt_index (str, default 'alt_idx') – Add the alt index (position) for each sparse data row as a coords array with this name.
case_index (str, optional) – Add the case index (position) for each sparse data row as a coords array with this name. If not given, this array is not stored but it can still be reconstructed later from the case pointers.
case_pointer (str, optional) – Use this name for the case_ptr dimension, overriding the default.
- Returns
Dataset
See also
Dataset.from_idca
Construct a dense Dataset from a idca-format DataFrame.