vp.features.since_last
Seconds since the last event of a kind, and of any kind (catalog/since_last.viv).
Part of the distribution vipyr; it runs from a checkout of the
repository. Planned on PyPI as pip install vipyr.
Signature
vp.features.since_last(df=None, n=500, kind='purchase') Parameters
- df : pandas.DataFrame, default
None - The event table, rows in any order; None makes a synthetic one of n rows.
- n : int, default
500 - Rows of the synthetic table when df is None. Range: >= 1.
- kind : str, default
'purchase'
Returns
A frozen SinceLastResult. Iterating it gives the fields below in order; it also has
params, tests, log and check().
- frame : pandas.DataFrame
- The features, one row per input row, in the input's order and index: .
Raises
- TypeError
- An argument of the wrong type, or an unknown keyword.
- vipyr.VivBuildError
- An ImportError: no C compiler, or the program's C does not build.
Examples
import vipyr as vp
r = vp.features.since_last() # a synthetic table; pass df= for yours
print(r.frame.head())
assert r.check() secs_since_hit secs_since_prev
0 NaN NaN
1 NaN 52443.0
2 NaN 54821.0
3 NaN 12638.0
4 NaN 159535.0Each example ran as written when these pages were generated, and the output shown is what it printed.
Checked against
- Reference
- catalog.since_last_reference: a pandas groupby().apply() with a Python loop per row, equal bit for bit; vipyr.check_point_in_time: no feature reads a row after its own time
Source
- Viv: catalog/since_last.viv
- Viv: catalog/catalog.py
- The defs it reaches and the calls between them: map of the code