Skip to main content

Markov model

Import libraries

from ChannelAttributionPro import *
pd.set_option('display.expand_frame_repr', False)

Set the password

password="mypassword"

Load data

Data = pd.read_csv("https://app.channelattribution.net/data/Data.csv",sep=";")

print(Data)

Perform transaction level attribution reading data from a data.frame

res=markov_model(Data=Data, var_path="path", var_conv="total_conversions", 
var_value="total_conversion_value", var_null="total_null",
cha_sep=">", password=password)
path_attribution=res["attribution"]
print(path_attribution)

Return non converting paths in the output data.frame

res=markov_model(Data=Data, var_path="path", var_conv="total_conversions", 
var_value="total_conversion_value",var_null="total_null",
cha_sep=">", flg_write_nulls=1, password=password)
path_attribution=res["attribution"]
print(path_attribution)

Return paths in the output data.frame

res=markov_model(Data=Data, var_path="path", var_conv="total_conversions", 
var_value="total_conversion_value", var_null="total_null",
cha_sep=">", flg_write_paths=1, password=password)
path_attribution=res["attribution"]
print(path_attribution)