WideData

WideData(df, outputs[, log_vars, ...])

Container for wide-form tabular data, allowing simple access to standardized and/or transformed values.

Methods

WideData.from_tidy(tidy[, outputs, ...])

Constructs WideData from a tidy-form dataframe.

WideData.to_tidy()

Converts to TidyData

Attributes

WideData.t

Transformed data values.

WideData.z

Standardized data values.

WideData.df

WideData.outputs

class gumbi.aggregation.WideData(df: DataFrame, outputs: list, log_vars: list | None = None, logit_vars: list | None = None, names_column: str = 'Variable', values_column: str = 'Value', stdzr: Standardizer | None = None)

Bases: MetaFrame

Container for wide-form tabular data, allowing simple access to standardized and/or transformed values.

Note that WideData is instantiated with a wide-form dataframe. This class is not intended to be instantiated directly, use DataSet instead. WideData subclasses pandas’ DataFrame, which everyone says is a bad idea, so be prepared for unexpected behavior if instantiated directly. Namely, in-place modifications return a WideData type correctly, but slices return a pd.DataFrame type.

Parameters:
  • data (pd.DataFrame) – A wide-form dataframe.

  • outputs (list) – Columns of data to be treated as outputs.

  • names_column (str, default 'Variable') – Name to be used in tidy view for column containing output names.

  • values_column (str, default 'Value') – Name to be used in tidy view for column containing output values.

  • log_vars (list, optional) – List of input and output variables to be treated as log-normal. Ignored if stdzr is supplied.

  • logit_vars (list, optional) – List of input and output variables to be treated as logit-normal. Ignored if stdzr is supplied.

  • stdzr (Standardizer, optional) – An Standardizer instance. If not supplied, one will be created automatically.

classmethod from_tidy(tidy, outputs=None, names_column='Variable', values_column='Value', stdzr=None, log_vars=None, logit_vars=None)

Constructs WideData from a tidy-form dataframe. See WideData for explanation of arguments.

property t: DataFrame

Transformed data values.

to_tidy() TidyData

Converts to TidyData

property z: DataFrame

Standardized data values.