modelhub.ModelHub.map
property mapβ
Access map methods from the model hub.
class Mapβ
(mh)Methods in this class can be used to map data in a DataFrame with Objectiv data to series values.
Always returns Series with same index as the DataFrame the method is applied to, so the result can be set as columns to that DataFrame.
conversions_counterβ
(data, name, partition='session_id')Counts the total number of conversions given a partition (ie session_id or user_id).
Parametersβ
nameβ the name of the conversion to label as set inModelHub.conversion_events.partitionβ the partition over which the number of conversions are counted. Can be any column of the ObjectivFrame
Returnsβ
bach.SeriesBoolean with the same index as data.
conversions_in_timeβ
(data, name, partition='session_id')Counts the number of time a user is converted at a moment in time given a partition (ie βsession_idβ or βuser_idβ).
Parametersβ
dataβbach.DataFrameto apply the method on.nameβ the name of the conversion to label as set inModelHub.conversion_events.partitionβ the partition over which the number of conversions are counted. Can be any column indata.
Returnsβ
bach.SeriesInt64 with the same index as data.
is_conversion_eventβ
(data, name)Labels a hit True if it is a conversion event, all other hits are labeled False.
Parametersβ
dataβbach.DataFrameto apply the method on.nameβ the name of the conversion to label as set inModelHub.conversion_events.
Returnsβ
bach.SeriesBoolean with the same index as data.
is_first_sessionβ
(data)Labels all hits in a session True if that session is the first session of that user in the data.
Parametersβ
data β bach.DataFrame to apply the method on.
Returnsβ
bach.SeriesBoolean with the same index as data.
is_new_userβ
(data, time_aggregation=None)Labels all hits True if the user is first seen in the period given time_aggregation.
Parametersβ
dataβbach.DataFrameto apply the method on.time_aggregationβ if None, it uses theModelHub.time_aggregationset in ModelHub instance.
Returnsβ
bach.SeriesBoolean with the same index as data.
pre_conversion_hit_numberβ
(data, name, partition='session_id')Returns a count backwards from the first conversion, given the partition. I.e. first hit before converting is 1, second hit before converting 2, etc. Returns None if there are no conversions in the partition or after the first conversion.
Parametersβ
dataβbach.DataFrameto apply the method on.nameβ the name of the conversion to label as set inModelHub.conversion_events.partitionβ the partition over which the number of conversions are counted. Can be any column indata.
Returnsβ
bach.SeriesInt64 with the same index as data.