Data - building labels (pynance.data.lab)

These functions are intended to be used in conjunction with functools.partial() to pass to pynance.data.combine.labeledfeatures(). For example:

>>> from functools import partial
>>> features, labels = pn.data.labeledfeatures(eqdata, 256,
...        partial(pn.data.lab.growth, 32))
pynance.data.lab.growth(interval, pricecol, eqdata)[source]

Retrieve growth labels.

Parameters:

interval : int

Number of sessions over which growth is measured. For example, if the value of 32 is passed for interval, the data returned will show the growth 32 sessions ahead for each data point.

eqdata : DataFrame

Data for evaluating growth.

pricecol : str

Column of eqdata to be used for prices (Normally ‘Adj Close’).

Returns:

labels : DataFrame

Growth labels for the specified period

skipatend : int

Number of rows skipped at the end of eqdata for the given labels. Used to synchronize labels and features.

Examples

>>> from functools import partial
>>> features, labels = pn.data.labeledfeatures(eqdata, 256, 
...        partial(pn.data.lab.growth, 32, 'Adj Close'))