Abstract Data Interface

Both DT and DB classes are derived from a common abstract base class, which defines a handful of important interface functions.

class larch.core.Fountain

This object represents a source of data. It is an abstract base class from which both the DT and DB classes are derived.

alternative_names()

A vector of the alternative names used by this Fountain.

alternative_codes()

A vector of the alternative codes (64 bit integers) used by this Fountain.

alternative_name()

Given an alternative code, return the name.

alternative_code()

Given an alternative name, return the code.

array_idco(*vars, dtype='float64')

Extract an array of idco Format data from the underlying data source. The vars arguments define what data columns to extract, although the exact format and implementation is left to the base class.

array_idca(*vars, dtype='float64')

Extract an array of idca Format data from the underlying data source. The vars arguments define what data columns to extract, although the exact format and implementation is left to the base class.

check_co(column)

Validate whether column is a legitimate input for Fountain.array_idco().

check_ca(column)

Validate whether column is a legitimate input for Fountain.array_idca().

variables_co()

Return a list of the natural columns of idco Format data available.

variables_ca()

Return a list of the natural columns of idca Format data available.

export_all(*arg, **kwarg)

Export all data (idca and idco) to one big idco format csv file.

This method takes the dataframe from dataframe_all() and writes it out to a csv file. All arguments are passed through to pandas.DataFrame.to_csv(). No effort is made to prevent duplication of data in this export (e.g. if there are idco variables stacked to make a single idca variable, these will appear in the output twice).

dataframe_all()

Load all data (idca and idco) to one big idco format pandas.DataFrame.

No effort is made to prevent duplication of data in this DataFrame. (e.g. if there are idco variables stacked to make a single idca variable, these will appear in the output twice). If there is a lot of data, this DataFrame could be very large.

dataframe_idco(*vars, **kwargs)

Load a selection of idco Format data into a pandas.DataFrame.

This function passes all parameters through to Fountain.array_idco().

dataframe_idca(*vars, wide=False, **kwargs)

Load a selection of idca Format data into a pandas.DataFrame.

Parameters:wide (bool) – If True (defaults False), the resulting data array will be pivoted to be idco Format, with one row per case and a hierarchical columns definition.

This function passes all other parameters through to Fountain.array_idca().